html - Why does styling the background of the body element affect the entire screen? -


when style background of body element, why styling affect entire screen , not body element itself? let's create following rule:

body {width: 700px; border: 1px dotted red; background-color: blue;} 

i find border shows 700px wide expect, background color occupies entire browser viewport. why?

quote http://www.w3.org/tr/css21/colors.html

the background of root element becomes background of canvas , covers entire canvas, anchored (for 'background-position') @ same point if painted root element itself. root element not paint background again.

the body element root-element, , thus, required css rules loses background style , background style applied containing canvas (the webpage area in browser), therefor entire screen blue. other properties stay element (e.g. border).


Popular posts from this blog