I have a html document where i would like to have an image as a background. For the next example eveything works great:
<html><head></head><body><div id="principal"></div></body></html>
css:
#principal
{
background: url(../Img/org/world.png) no-repeat;
width:100%;
height:100%;
background-size: 100% 100%;
}
but if i rewrite the html file to :
<!DOCTYPE html><html><head></head><body><div id="principal"></div></body></html>
the image from css ( background: url(../Img/org/world.png) no-repeat; ) is not displayed anymore. Why?
Add this to your style-sheet:
The DIV you set to 100% doesn’t have any reference to what it should set 100% of. Telling the browser that the document is to fill 100% of what is available creates a reference for the div element.
A fiddle to fiddle around with:
http://jsfiddle.net/UJsRW/