内容没有出现在网格系统中的正确位置。 Bootstrap
The The content does not appear in the correct position in the Grid system. Bootstrap
我在设计中遇到 logo
和 navbar
的问题。 logo
有 3 列,navbar
有 6 列,就像这张图片
但是当我运行代码时,它们没有出现在正确的位置,我现在不知道代码中的错误在哪里。他们在浏览器中是这样的:
这是 HTML 代码和 css:
body {
font-family: 'Raleway' font-size: 16px;
color: #fff;
font-weight: 400;
letter-spacing: 1px;
background: #003153;
}
header {
background: url(images/home-bg.png) center repeat-y;
min-height: 760px;
width: 100%;
padding: 50px;
}
.navbar {
background: 0;
padding: 0;
border: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700" rel="stylesheet" type="text/css">
<!--header-->
<header>
<div class="container">
<div class="row">
<div class="col-lg-3 logo"><img src="images/Logo.png" alt="logo"></div>
<div class="col-lg-6 menu">
<nav class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="mainMenu" aria-expanded="false">
<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="#"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="mainMenu">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li><a href="#">About me</a></li>
<li><a href="#">Courses</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Articles</a></li>
<li><a href="#">Contacts</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
</div>
<div class="col-lg-3 search"></div>
</div>
</div>
</header>
谢谢
您必须将 =
(等于/赋值运算符)与每个 class 属性放在一起
应该是
<div class="col-lg-3 logo"><img src="images/Logo.png" alt"logo"></div>
<div class="col-lg-6 menu">
我在设计中遇到 logo
和 navbar
的问题。 logo
有 3 列,navbar
有 6 列,就像这张图片
但是当我运行代码时,它们没有出现在正确的位置,我现在不知道代码中的错误在哪里。他们在浏览器中是这样的:
这是 HTML 代码和 css:
body {
font-family: 'Raleway' font-size: 16px;
color: #fff;
font-weight: 400;
letter-spacing: 1px;
background: #003153;
}
header {
background: url(images/home-bg.png) center repeat-y;
min-height: 760px;
width: 100%;
padding: 50px;
}
.navbar {
background: 0;
padding: 0;
border: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700" rel="stylesheet" type="text/css">
<!--header-->
<header>
<div class="container">
<div class="row">
<div class="col-lg-3 logo"><img src="images/Logo.png" alt="logo"></div>
<div class="col-lg-6 menu">
<nav class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="mainMenu" aria-expanded="false">
<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="#"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="mainMenu">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li><a href="#">About me</a></li>
<li><a href="#">Courses</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Articles</a></li>
<li><a href="#">Contacts</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
</div>
<div class="col-lg-3 search"></div>
</div>
</div>
</header>
谢谢
您必须将 =
(等于/赋值运算符)与每个 class 属性放在一起
应该是
<div class="col-lg-3 logo"><img src="images/Logo.png" alt"logo"></div>
<div class="col-lg-6 menu">