HTML <body> with background image
Lets say I have a tag and in the CSS, I define it as having a bacground image of 1px wide, with repeat-x...Also f开发者_StackOverflow社区or this body, I do not define or give any width..
There is some other content present on the page as well..
Now my question is what or how wide will this background image given to the body span...Like what will be it's bounding box and what will be it's width ?
It will be bound to the element (and therein the size of the element) that has been specified in the CSS per the CSS rules of specificity. In the case of the <BODY>
tag, it will continue for the width of the browser window.
If the element has inherited it's width from a parent element for some reason the background image will go for this parent elements specified width less padding and margins.
More info on the rules of specificity at Smashing Magazine
I hope this helps.
If the body tag is unconstrained by any CSS or scripting, then it's width will be the larger of the width of the window or the max width of the content within it (similar rules as a div). So, your background will repeat full width. An unconstrained body height will only be as tall as the content inside it.
精彩评论