View Single Post
Old 08-18-2025, 04:36 PM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,981
Karma: 147448039
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ElMiko View Post
Honestly, this seems like the first question I should have asked when I started doing this...

But does it matter what order styles appear within a given class?

Specifically I'm thinking about things like font-size and margins, but i'm sure there are other similar examples. If you're using em units, the height of a margin will scale based on the font size. But I thought that html is read top to bottom, so in theory the code

Code:
p {
font-size: 2em;
margin-top: 1em;
}
should look diffierent than

Code:
p {
margin-top: 1em;
font-size: 2em;
}
since the first case has a margin that is equal to one line of 2em text (as font-size has been previously established), whereas I would think that the second has a margin that equal to 1em text as it hasn't "read" that the text is supposed to be 2em yet, and by the time it does it's already defined the height of the margin.

But it appears that NOT what happens; they both tend to look the same. Am I misuderstanding the way top-to-bottom works in HTML?
Both CSS are identical in what they do. CSS classes are read from top to bottom but in each class what's there is taken as a group.
JSWolf is offline   Reply With Quote