我希望导航栏元素从边缘开始。有点像amazon这样做。我正在使用bootstrap基本主题,它有一个可折叠的导航栏div,我认为它阻止我移动它们,但我不确定。
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>SheetPal</title>
<link href="css/navbar.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 70px;
}
</style>
<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color: #2555a3; border-bottom: none;" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">SheetPal</a>
<a class="navbar-brand" href="#">Dashboard</a>
<a class="navbar-brand" href="#">Your Hours</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#">
User
</a>
</li>
<li>
<a href="#">Support</a>
</li>
</ul>
</div>
</div>
</nav>
答案 0 :(得分:3)
您需要使用.container-fluid
来获取您的需求。请检查代码
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color: #2555a3; border-bottom: none;" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">SheetPal</a>
<a class="navbar-brand" href="#">Dashboard</a>
<a class="navbar-brand" href="#">Your Hours</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#">
User
</a>
</li>
<li>
<a href="#">Support</a>
</li>
</ul>
</div>
</div>
</nav>