Hey Jody,

First of all, the rules are incorrectly written. you need to include a property in front of the value:

@media print
{
        body { color: #FFFFFF; }
}

@media all
{
        body { color: #990000; }
}


Secondly, the "winner" is the second rule. @media rules are just "containers" for a bunch of rules. They have no control over the cascade. The important thing here is the order they are written.

For printers you specify white text. Then for all devices (including printers) you specify a dark red text. The second rule wins due the the rules of the cascade:

both rules are from the same origin (author)
both rules have the same !important (none applied)
both rules have the same specificity (selector weight)

Therefore, the order that they are written in is the key and the last rule specified will win.

Thanks
Russ

--------------------------------------------------
Russ Weakley
Max Design
Phone: (02) 9410 2521
Mobile: 0403 433 980
Email: r...@maxdesign.com.au
Skype: russ-maxdesign
MSN: r...@maxdesign.com.au
Website: http://www.maxdesign.com.au/
Twitter: http://twitter.com/russmaxdesign
Linkedin: http://www.linkedin.com/in/russweakley
Slideshare: http://www.slideshare.net/maxdesign/
--------------------------------------------------




On 06/08/2010, at 3:20 AM, Jody Tate wrote:

Hi all,

Does @media rule ordering in a stylesheet matter? For example, given the following order:

@media print {
        body {
                #FFFFFF;
        }
}

@media all {
        body {
                #990000;
        }
}

Will @media print override the @media all in this ordering?

Googling around, I've not found a clear answer to the question. So, any help is appreciated.

Thanks in advance,
jody

*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************




*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************

Reply via email to