That’s right, CSS will blatantly ignore the stated order of your HTML elements and just do whatever the heck it wants. Or, as the CSS spec states:
[…] CSS cares nothing for your whims. Nothing for your dreams. Nothing for your foolish allocations of space and time and meaning. To discover CSS is to discover a space void of progress, a universe with no moral absolutes where your carefully-planned DOM structure is just a scream into the endless void. […] Nowhere shall this sublimity of chaos be more evident than in the interaction of such properties as
display. You may say their names. You may vainly wish to invoke their powers. But tread lightly, because you cannot control them.
If you like poking fun at inconsistent implementations, or just need to blow off some stress after debugging your CSS, you should give Issac Lyman’s article a read.
– Thanks to Mark for sharing!