简体   繁体   中英

Add image below navbar in Twitter bootstrap

I'm facing a problem with Bootstrap due to lines:

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <a class="brand" href="/"></a>
        </div>
    </div>
</div>

<div id="main_top">
    <div class="container">
        <div class="row">
            <div class="span12">
                            ...

In the main_top I have a background image. The problem happens when I resize the browser due to the following code:

@media (max-width: 979px)
.navbar-fixed-top {
margin-bottom: 20px;
}

Basically, when browser width < 979, there's a white line due to 20px margin.

Could you help me to fix it? I also created a sample here: http://jsfiddle.net/TxRgF/

Working DEMO

What about this:

@media (max-width: 979px){
    body{
      padding-left:0 !important;
      padding-right: 0 !important;
    }

   .navbar-fixed-top {
      margin-bottom: 0px !important;
   } 

}

At that width, the body has left and right padding. Add this class at the end of your CSS.

@media (max-width: 767px){
  body {
   padding-left:0 !important;
   padding-right: 0 !important;
 }
}

http://jsfiddle.net/simply_simpy/ryjMT/2/

You will need to add padding to other elements to compensate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM