Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Can';t使顶部导航栏全宽_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html Can';t使顶部导航栏全宽

Html Can';t使顶部导航栏全宽,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,披露:我试图在stack exchange存档中找到这个问题的解决方案,但没有任何效果 我正在尝试创建一个导航栏,它在引导中跨越页面的整个宽度 我做不到 我试着用col-md-12类、我自己创建的新类和navbar static top来实现这一点。它们都不起作用。导航栏的左右两边总是有奇怪的10px左右的边距。在我看来,在某个父元素或包含导航条的某个div中似乎有填充,但我一辈子都找不到它 也没什么价值:页面的其余部分是col-md-12,没有这个问题 下面是一些可能相关的CSS元素。我基本上

披露:我试图在stack exchange存档中找到这个问题的解决方案,但没有任何效果

我正在尝试创建一个导航栏,它在引导中跨越页面的整个宽度

我做不到

我试着用col-md-12类、我自己创建的新类和navbar static top来实现这一点。它们都不起作用。导航栏的左右两边总是有奇怪的10px左右的边距。在我看来,在某个父元素或包含导航条的某个div中似乎有填充,但我一辈子都找不到它

也没什么价值:页面的其余部分是col-md-12,没有这个问题

下面是一些可能相关的CSS元素。我基本上把所有东西都调整到100%宽度

包含/父元素

html {
font-family: Impact;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
height: 100%;
width: 100%;
margin: 0%;
padding: 0%;
}

body {
margin: 0%;
padding: 0%;
height: 100%;
width: 100%;
background-image: url(../images/background.jpg);
background-size: 100% 100%;
background-repeat: no-repeat;
}

.container {
padding-right: 0%;
padding-left: 0%;
margin-right: auto;
margin-left: auto;
height: 100%;
width: 100%;
}

.container-fluid {
padding-right: 0%;
padding-left: 0%;
margin-right: auto;
margin-left: auto;
height: 100%;
}

.col-md-12.alpha {
height: 100%;
width: 100%;
}
尝试创建导航栏本身

  .col-md-12.beta {
  background-color: black;
  height: 10%;
  width: 100%;
  margin: 0%;
  padding: 0%;
  }

  .navbar1 {
  background-color: black;
  opacity: 0.4;
  height: 10%;
  width: 100%;
  margin: 0%;
  padding: 0%;
  }

.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
background-color: black;
min-height: 10px;
}
只需将您的
放在主体中的主div容器之外。我知道容器必须包装所有引导元素。。嗯,不是。即使在他们自己的模板示例中,他们也将
指令从外部删除

不要忘记将导航中的所有内容放入容器中:

<body>
  <nav class="navbar navbar-default navbar-static-top">
    <div class="container">
      ...
    </div>
  </nav>
  ...
</body>

...
...

您能提供问题页面的URL吗?我认为问题出在代码的其他地方。显示html页面代码