html - Bootstrap 中页脚下方的空白?

标签 html css twitter-bootstrap

Inspect element The white space below footer

不知道那个空间是怎么来的。我不想要固定的页脚,只想要固定的导航栏。我的导航栏工作正常,但页脚下方有一些空白。

body {
  padding-top: 4.5rem;
    min-height:100%;
}
.footer {
  position: relative;
  bottom: 0;
  width: 100%;
  /* Set the fixed height of the footer here */
    left: 0;
  height: 60px;
  line-height: 60px; /* Vertically center the text there */
  background-color: #000000;
}

这是页脚的 CSS。我正在使用 Bootstrap 4。

<body>
    <div class="container-fluid">
        <nav ..... #code for navbar
        </nav>          
    <div class="row justify-content-center">
        <div class="col-6">
           <div class="card">
       ~~~~MY CONTENT~~~
           </div>
         </div>
     </div>
     <div class="row">
        <footer class="footer">
          <div class="container">
            <span class="text-muted">Place sticky footer content here.</span>
          </div>
        </footer></div>
        </div>
    </div>

但是,当我将 CSS 更改为 position:fixed 时。它工作正常,但我不想要那样。提前谢谢你。

Updated screenshot

最佳答案

您的内容元素的高度不是屏幕的高度。因此,您的页脚将是这样的,您可以使用 JavaScript 或将内容放入您的容器中。

关于html - Bootstrap 中页脚下方的空白?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44911477/

相关文章:

twitter-bootstrap - Bootstrap 4 切换/单选按钮组

javascript - 从嵌套数组到对象数组

HTML div : Auto height and overflow: auto?

jquery - 通过 jQuery 创建的 Textarea - 但不可编辑,为什么?

javascript - 我怎样才能让 less.js 和 bootstrap 工作?

css - Material (垂直)步进器

css - 没有使用 Bootstrap for Angular 渲染的样式

javascript - 在标准浏览器中运行 Lua 5.3 并保持最大合规性的最简单方法是什么?

html - CSS 选择器

javascript - 创建有序列表并生成输入字段 HTML 和 JS