Skip to content Skip to sidebar Skip to footer

Background Image Is Not Showing In Css

I have searched on the internet and found that setting body, html height, width to 100% will fix the issue but it did not. I have this html:
Copy

Solution 2:

Stretch the .index container as well to fill the space of the body, otherwise it will only be as tall as the content inside.

 html,
 body {
     height: 100%;
     width: 100%;
 }
 .index {
     background-image: url("http://lorempixel.com/g/500/500");
     background-size: cover;
     background-repeat: no-repeat;
     width: 100%;
     height: 100%;
 }

DEMO: http://jsfiddle.net/64917998/1/


Solution 3:

You have to give your .index class a height. Either a static or dynamic.

.index{
   height: 100%;
   background-image: url("../images/index-bg.jpg");
   background-size: cover;
   background-repeat: no-repeat;
}

Jsfiddle


Post a Comment for "Background Image Is Not Showing In Css"