内容未出现在网格系统中的正确位置。引导

时间:2018-01-04 04:46:22

标签: html css bootstrap-grid

我在设计中遇到了 logo navbar 的问题。 logo 有3列, navbar 有6列,如此图片

enter image description here

但是当我运行代码时它们没有出现在正确的位置,我现在不知道代码中的错误在哪里。他们是这样在浏览器中出现的:

enter image description here

这是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>
&#13;
&#13;
&#13;

谢谢

1 个答案:

答案 0 :(得分:0)

您必须将=(等于/赋值运算符)与每个类属性放在一起 它应该是

 <div class="col-lg-3 logo"><img src="images/Logo.png" alt"logo"></div>
 <div class="col-lg-6 menu">