Shen
Shen

Reputation: 102

cant force image full width with css

i try many ways to force my image full width but it can't

a busy cat

you can see my arrows and my html and css code :

 <div class="homeContentWrapper">
           <!-- WELCOME BOX-->
          <div class="imgBghome">
            <img class="bgCau" src="images/cau.jpg">
         </div>
</div>

and my css

.homeContentWrapper{
     position: relative;
     height: 726px; 
     width: 100%;
     z-index:0;
}

.imgBghome{
    position:relative;
    overflow:hidden;
    height:100%;
    width:100%;
    right:0;
    left:0;
    top:0;
    bottom:0;
    margin:auto;
    z-index:0;  
}

please give me advices

thank you!

Upvotes: 0

Views: 1040

Answers (2)

Hoijof
Hoijof

Reputation: 1413

You could set the image as a background of the body. It's a clean way of setting a background and you will use no HTML elements.

body {
    background-image : url("images/cau.jpg");
    background-size  : cover;
}

Upvotes: 0

Pradeep Pansari
Pradeep Pansari

Reputation: 1297

You can try below code:

body{margin:0;}

Upvotes: 3

Related Questions