Fabian,

The last style definition always wins from the the one that came before it, unless it is less specific.
Like so:

 <div class="message">correct </div>
 <div class="message error">oops</div>

div.message {
  color: black;
  background-color: green;
}

div.message.error {
  background-color: red;
}

In this example the order of the style definitions wouldn't matter because div.message.error is more specific.

-Thomas.





On Jan 8, 2007, at 15:46 , Fabian Lange wrote:


Hi,
I know that my question doesnt aim 100% at this group, but at least here are people that care for cross browser behaviour.

Is there a guaranteed behaviour for elements having multiple classes?

<div class="red blue">hello world</div>

when
div.red { background-color:red;}
div.blue {background-color:blue;}

it will be blue.

<div class="blue red">hello world</div>

will also be blue. So order in className will not matter.

when I switch the lines in the css:
div.blue {background-color:blue;}
div.red { background-color:red;}

it will be red in both cases.
So is the order of the css definitions always relevant for the style of the elements?

I noticed that adding or removing class name on runtime doesn't change this behaviour. Even when the first css class is added later on the div will look always like the second defined css class

So despite this being a bit odd to me (not the css definition but the element definition should infulence that imho), I wonder if all browsers behave the same here.

Thanks
Fabian

______________________________________________________________________ _ Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222


>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to