Please consider the following CSS. Note that there are no other CSS rules defined or in effect in this situation:
* {
position: absolute;
color: red;
}
div {
position: static;
color: blue;
}
When I add a div with a bit of text, which is live here, the text in the div no longer traverses the entire screen. It is as though the width property of the div is set to 10%. If I remove the position:absolute declaration from the wildcard, the div returns to normal (the text goes the whole way across the screen). This is puzzling to me, since I have all divs defined with the position:static declaration. I tried this with and without the famous "reset.css" stylesheet included, and I am getting the same results.
At first i thought that perhaps the wildcard rule takes presidence over the div rule in CSS. That would have been simple enough. However, I have the color property of the wildcard rule set to red and the color property of the div rule set to blue, and the text is showing up blue. So the answer cannot simply be that the wildcard rule takes precedence over the div rule.
One thing I think might be relevant: an absolutely positioned element is positioned relative to its first positioned (not static) ancestor element. In this case, the body has no such ancestor, and therefore this is probably just some kind of silent error caused be the body being set to absolute positioning but with no positioned ancestor element.
Does anyone know what the cause of this odd behavior is?