无法覆盖nav和jumbotron之间的边距

时间:2016-04-26 03:50:48

标签: css twitter-bootstrap

问题:引导程序中.nav.jumbotron之间的空格。

我做了什么:覆盖bootstrap.css,覆盖.jumbotron{margin-bottom:0px},它无效。

我发现:当我在原始文件中调试它时效果很好。

couldn't work in override css file

work well in original file

HTML:

<body>
<div class="header">
  <div class="top-header">
    <div class="jumbotron">
        <img src="image/name.png" alt="">
        <h2>Curiosity Creative</h2>
    </div><!--Jumbotron-->
  </div><!--top-header-->

  <nav class="navbar navbar-default">
    <div class="container">
    <!-- 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="#displayItem" 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>
         </div><!--navbar-header-->
    <!-- Collect the nav links, forms, and other content for toggling -->
           <div class="collapse navbar-collapse" id="displayItem">
                <ul class="nav nav-tabs">
                    <li class="home active">
                    <a href="index.html"><i></i> Home</a></li>
                    <li class="me">
                    <a href="aboutMe.html"><i></i>AboutMe</a></li>
                    <li class="blog">
                    <a href="Blog.html"><i></i>Blog</a></li>
                    <li class="contact">
                    <a href="Contact.html"><i></i>Contact</a></li>
                </ul>
           </div> <!-- collapse navbar-collapse-->      
    </div><!--container -->
  </nav><!--nav-->      
</div>

CSS:

*{
margin: 0;
padding: 0;
}
body{
background: url("../image/body_bg.jpg");
overflow: scroll;
}
div{
   position:relative;
 }
.top-header{
   background-color: white;
 }
.jumbotron {
    background-color:transparent !important; 
    text-align: center;
    margin-bottom:0px;
 }
.jumbotron img{
    width: 400px;
 }
.jumbotron h2{
    color: #aaa;
    font-size: 13px;
    font-family: verdana;
  }

1 个答案:

答案 0 :(得分:1)

在我看来,也许你已经包含了你的&#34; index.css&#34;在&#34; bootstrap.css&#34;之前。如果这是正确的,交换它们,以便你的&#34; index.css&#34;最后加载,而不是第一次。

例如

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/index.css" rel="stylesheet">