Bootstrap导航栏固定顶部隐藏页面内容

时间:2020-04-27 12:10:09

标签: html css bootstrap-4

我正在为我的项目使用Bootstrap 4。每当我创建一个新的设计页面时,每次都必须定义一些自定义边距和填充,以使内容显示在页面上。

在检查元素时,我注意到这是由于导航栏中的 fixed-top 类。

<nav class="navbar navbar-expand-md fixed-top navbar-dark  main-nav">

style.css

fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

我已经发布了内容,看起来还是这样

enter image description here

我尝试了类似的方法,但是没有用 style.css

html
{
  margin: 0 auto;
}
body {
margin: 0 auto;
}

我需要一些建议,以使其将来可用于所有新创建的页面。

0 个答案:

没有答案