2 replies [Last post]
blakems
blakems's picture
Offline
Enthusiast
UTah, USA
Last seen: 16 years 31 weeks ago
UTah, USA
Timezone: GMT-7
Joined: 2003-04-07
Posts: 60
Points: 0

What style sheets takes precident over the other styles sheets. Is it the last one listed in the document flow, which I think it is, or is the the first one in the document flow?

Basically what is the cascading order?

-bMs-
http//www.blakems.com !important;

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 6 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Cascading order

Hi Blakems,
Style rules are given a weight based on cascade rules set out by W3C
They can explain it much better then I can Wink

You are correct in your assumption, if style rules have the same weight then the order is important.

If you have two rules with the same weight the last should override the first.

P{width:200px;}
P{width:500px;}
should give you all P set to 500px

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 3 years 41 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Cascading order

Yes Tony is right there.

If you had:

DIV.updateTitle {
  margin : 5px;
  font-size: x-large;
  font-weight: bold;
}

DIV.updateTitle {
  margin : 10px;
}

the margin is taken from the bottom, but the DIV still has the font-size and weight from the top one.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.