CSS: Fullscreen DIV with Margin

I finally found a solution to have a fullscreen DIV element with a margin without showing scrollbars. Can you believe it?

#fullscreen-with-margin {
	display: block;
 
	position: absolute;
 
	top: 40px;
	left: 0px;
	bottom: 0px;
	right: 0px;
 
	width: auto;
	height: auto;
}

The trick is specifying the "bottom: 0px;" and "right: 0px;" values. One can imagine, that the DIV element is "streched" by doing this. "display: block;", "width: auto;" and "height: auto;" are default values (thus could be left out) but are made specific here.

Source: http://stackoverflow.com/questions/485827/css-100-height-with-padding-margin

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply