If you have several div
s on a page, you can use CSS to size, float them and move them round a little... but I can't see a way to get past the fact that the first div
will show near the top of the page and the last div
will be near the bottom! I cannot completely override the order of the elements as they come from the source HTML, can you?
I must be missing something because people say "we can change the look of the whole website by just editing one CSS file.", but that would depend on you still wanting the div
s in the same order!
(P.S. I am sure no one uses position:absolute
on every element on a page.)
Adding the ! important keyword to any CSS rule lets the rule forcefully precede over all the other CSS rules for that element. It even overrides the inline styles from the markup. The only way to override is by using another !
The Order of CSS Classes in HTML Doesn't Matter.
The z-index property specifies the stack order of an element.
CSS can take elements out of the normal flow and position them anywhere, in any manner you want. But it cannot create a new flow.
By this I mean that you can position the last item from the html document at the beginning/top of the page/window, and you can position the first item from the html document at the end/bottom of the page/window. But when you do this you can't position these items relative to each other; you have to know for yourself how far down the end of the page will be for the first item from the html document to be positioned correctly. If that content is dynamic (ie: from a database or CMS), this can be far from trivial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With