如何在bootstrap-4中删除div的上边距

时间:2019-02-18 05:08:37

标签: html css twitter-bootstrap

如何在bootstrap-4中删除div的上边距,filterKeyword类无效,自定义CSS mt-0也无效。

margin-top: 0;

在CSS文件中,将正文和html高度设为100%。

1 个答案:

答案 0 :(得分:0)

nav上使用此html更改类mb-0,最后将div类更改为h-75 bg-info

使用以下代码。

       <nav class="navbar navbar-expand-sm navbar-dark bg-primary mb-0 py-0">
      <div class="container">
        <a href="#" class="navbar-brand"
          ><span id="branding">A&K</span> Resturant</a
        >

        <button
          class="navbar-toggler"
          type="button"
          data-toggle="collapse"
          data-target="#navbarNavAltMarkup"
          aria-controls="navbarNavAltMarkup"
          aria-expanded="false"
          aria-label="Toggle navigation"
        >
          <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item">
              <a href="#" class="nav-link">Home</a>
            </li>
            <li class="nav-item">
              <a href="#" class="nav-link">About</a>
            </li>
            <li class="nav-item">
              <a href="#" class="nav-link">Services</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>

    <div class="h-75 bg-info">
Erat amet lorem magna amet stet et dolore. Ipsum est justo lorem takimata vero. Accusam invidunt takimata lorem ut lorem.
    </div>