简体   繁体   中英

Background image not spanning the entire container-fluid

I am new to this bootstrap. I have a background image which i want to put in the container fluid. How to do it.

This is my code:

<div class="image_outer">
    <div class="container-fluid">
         <div class="row-fluid">
                <div class="span5">
                     <div class="fl navi"> <a href="#" title="One" class="mr30">One</a> <a href="#" title="two">TwoP</a> </div>
                </div>
                <div class="span2"">
                     <div id="image1"><img src="/Something/something.jpg" alt="" /></div>
                </div>
                <div class="span5">
                     <div class="fr navi"> <a href="#" title="three" class="mr30">Three</a> <a href="#" title="four">Four</a> </div>
                </div>
         </div>
    </div>
</div>

The corresponding classes are

.image_outer{width:100%;margin:0 auto; background:url(Something/something_bg.jpg) repeat-x; height:128px;}
.fl{float:left;}
.fr{float:right;}
.mr30{margin-right:100px; font-family: ee_nobblee,arial;}
.navi a{ font-size:22px; color:#6D6E70; margin-top:50px; float:left; font-weight:normal; font-family:ee_nobblee,arial;}
.navi a:hover { text-decoration:none; color:#858687;}

Try This CSS:

.image_outer {
   width:100%;
   margin:0 auto; 
   background:url(Something/something_bg.jpg) repeat-x; 
   height:128px; 
   background-position:cover;
}

I might be wrong, you are floating children. you need to clear the float so that the background takes up the height specified.

<div class="row-fluid">
            <div class="span5">
                 <div class="fl navi"> <a href="#" title="One" class="mr30">One</a> <a href="#" title="two">TwoP</a> </div>
            </div>
            <div class="span2"">
                 <div id="image1"><img src="/Something/something.jpg" alt="" /></div>
            </div>
            <div class="span5">
                 <div class="fr navi"> <a href="#" title="three" class="mr30">Three</a> <a href="#" title="four">Four</a> </div>
            </div>
            <div style="clear:both"></div>
     </div>

Use your code like this and I hope this will work for image

.image_outer{width:100%;margin:0 auto; background:url(../Something/something_bg.jpg) repeat-x; height:128px;}

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