Hi ,

>How do browsers determine the winner in a conflict... well, AFAIK, they 
take the first style that is most relevant to the element.

That would be the LAST style that is most relevant to the element. (unless 
!important is used to override the cascade.)

It also worth noting that multiple stylesheets are also commonly 
referenced within CSS using @import.


The main benefit of using multiple stylesheets is for modular code.


Kind Regards,

Kane Tapping
Web Standards Developer
Web and Content Management Services
Griffith University. 4111. Australia.
[EMAIL PROTECTED]
Phone: +61 (0)7 3735 7630





"Steven Workman" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
28/02/2008 03:36 AM
Please respond to
wsg@webstandardsgroup.org


To
wsg@webstandardsgroup.org
cc

Subject
Re: [WSG] multiple css style sheets






Michael,

Multiple style sheets are quite common in large sites. Splitting your 
stylesheets into a "basics", "main" and "special cases" is good for 
keeping your code separate, also allowing multiple developers to work on 
different areas of a site's styles without interrupting each other. It's 
also becoming more common that any off the shelf javascript techniques 
come with their own stylesheets i.e. Cody Lindley's Thickbox.

How do browsers determine the winner in a conflict... well, AFAIK, they 
take the first style that is most relevant to the element.

Say you had <ul><li><span class="bob">Some text</span></li></ul>
If your first stylesheet said:
ul li { color:red;
}
and the second one said
.bob { color: blue;
}
It would render as blue.

However, if the first one said
ul li .bob { color:red;
}
and the second one remained the same
.bob { color: blue;
}
It would render as red

Steve Workman
PA Consulting Group
www.paconsulting.com
[EMAIL PROTECTED]
www.steel-software.com

On 27/02/2008, Michael Horowitz <[EMAIL PROTECTED]> 
wrote:
Just inherited a site and saw pages with multiple style sheets.  Is
there a reason for that and how does the browser determine what to use
if there is a conflict

--
Michael Horowitz
Your Computer Consultant
http://yourcomputerconsultant.com
561-394-9079



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to