首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS媒体屏幕断点

CSS媒体屏幕断点
EN

Stack Overflow用户
提问于 2020-04-04 09:00:25
回答 2查看 63关注 0票数 0

我正在使用Bootstrap 4,但是在bootstrap框架中已经有了媒体查询断点,现在我应该在哪里使用CSS断点选择器类?我在div类的行侧使用了一个选择器类,但它不起作用。下面是我的代码:

代码语言:javascript
复制
@media(max-width: 992px){
    .section-4 .section-breakpoint{
      flex-wrap: wrap!important;
      justify-content: center!important;
    }
    .section-4 .section-breakpoint > * {
      width: 100% !important;
    }
}
代码语言:javascript
复制
   <section class="section-4">
        <div class="container-fluid">
            <div class="row section-breakpoint">
                <article class="col-md-5 article first-article">
                    <hr class="hr-1">
                    <h2><i>More tools to help<br>
                        you do more</i></h2>
                    <h4><i>Analytics, social, and productivity</i></h4>
                    <hr class="hr-2">
                    <p>Easy-to-understand analytics ensure you're able to see at a glance exactly how well your website is performing with all Gator Website Builder accounts. Simple social media tools allow you to add live feeds from Instagram, Twitter, and Facebook in order to stay engaged. You can add G Suite productivity tools to your domain, enabling Gmail, Docs, Slides, and more.</p>
                    <h5><i><b>Get the best tools for $3.84/mo*</b></i></h5>
                    <a class="btn get-started-btn" href="#">BUY NOW</a>
                </article>
                <div class="col-md-7 text-right">
                    <img class="image-one" src="assets/images/product-7.png" alt="IMAGE-7">
                </div>
            </div>
        </div>
    </section>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-04-04 10:16:21

这是因为引导程序使用了max-width

代码语言:javascript
复制
@media(max-width: 992px){
    .section-4 .section-breakpoint{
      flex-wrap: wrap!important;
      justify-content: center!important;
    }
    .section-4 .section-breakpoint > * {
      width: 100% !important;
      max-width: 100% !important; /* Add this*/
    }
}
代码语言:javascript
复制
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

   <section class="section-4">
        <div class="container-fluid">
            <div class="row section-breakpoint">
                <article class="col-md-5 article first-article">
                    <hr class="hr-1">
                    <h2><i>More tools to help<br>
                        you do more</i></h2>
                    <h4><i>Analytics, social, and productivity</i></h4>
                    <hr class="hr-2">
                    <p>Easy-to-understand analytics ensure you're able to see at a glance exactly how well your website is performing with all Gator Website Builder accounts. Simple social media tools allow you to add live feeds from Instagram, Twitter, and Facebook in order to stay engaged. You can add G Suite productivity tools to your domain, enabling Gmail, Docs, Slides, and more.</p>
                    <h5><i><b>Get the best tools for $3.84/mo*</b></i></h5>
                    <a class="btn get-started-btn" href="#">BUY NOW</a>
                </article>
                <div class="col-md-7 text-right">
                    <img class="image-one" src="https://radiosol.cl/wp-content/uploads/2014/10/default-img-400x240.gif" alt="IMAGE-7">
                </div>
            </div>
        </div>
    </section>

您可以尝试使用bootstrap类在不覆盖css的情况下获得相同的结果。

票数 0
EN

Stack Overflow用户

发布于 2020-04-12 18:24:24

代码语言:javascript
复制
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

   <section class="section-4">
        <div class="container-fluid">
            <div class="row section-breakpoint">
                <article class="col-md-12 col-lg-5 article first-article">
                    <hr class="hr-1">
                    <h2><i>More tools to help<br>
                        you do more</i></h2>
                    <h4><i>Analytics, social, and productivity</i></h4>
                    <hr class="hr-2">
                    <p>Easy-to-understand analytics ensure you're able to see at a glance exactly how well your website is performing with all Gator Website Builder accounts. Simple social media tools allow you to add live feeds from Instagram, Twitter, and Facebook in order to stay engaged. You can add G Suite productivity tools to your domain, enabling Gmail, Docs, Slides, and more.</p>
                    <h5><i><b>Get the best tools for $3.84/mo*</b></i></h5>
                    <a class="btn get-started-btn" href="#">BUY NOW</a>
                </article>
                <div class="col-md-12 col-lg-7 text-center">
                    <img class="image-one" src="https://radiosol.cl/wp-content/uploads/2014/10/default-img-400x240.gif" alt="IMAGE-7">
                </div>
            </div>
        </div>
    </section>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61022549

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档