【问题标题】:Bootstrap 4 - Remove margin of the div under the navbar when the nav is expandedBootstrap 4 - 当导航展开时,删除导航栏下 div 的边距
【发布时间】:2018-03-19 17:05:06
【问题描述】:

有人可以帮忙解决这个问题吗

我想删除导航栏下的 div 的 margin-top(对于 margin-top 1rem 有一个永久的 my-3 类)。我希望仅当导航栏未展开时,margin-top 类 (my-3) 才处于活动状态,因为当导航栏展开时,它与 div 之间存在间隙。

 <div role="navigation"> </div>
        <div class="container-fluid ">
                <div class="row-9">
                  <div class="col-xl-9 my-3">
                  </div>
                </div>
        </div>

谢谢。

【问题讨论】:

    标签: css twitter-bootstrap margin bootstrap-4


    【解决方案1】:

    试试这样的:

    @media screen and (min-width: your choice) {
          .no-margin {
                  margin-top: 0px;
           }
    }
    

    然后在您喜欢的 div 上使用该类。如果您以正确的顺序放置 CSS 和引导程序的链接,您的代码将覆盖引导程序代码

    【讨论】:

    • 我想在导航栏展开时删除 div 的 my-3 类。不是永久的:\
    • @xx5ko 该类仅从特定宽度激活,这意味着如果您输入 min-width: 990px​​;该类将在大于 990 像素的屏幕上激活
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-23
    • 1970-01-01
    • 1970-01-01
    • 2020-09-26
    • 1970-01-01
    • 2018-02-07
    • 1970-01-01
    相关资源
    最近更新 更多