Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > CSS Priority

Reply
Thread Tools

CSS Priority

 
 
EYEBUZZ
Guest
Posts: n/a
 
      01-29-2004
Hello,

If you have a style sheet that is linked from an HTML document AND you have a
duplicate style sheet actually on the page, meaning some names are the same but
parameters are different, which takes priority (which does the browsers look
too for instruction)?

Does this change in different browsers/platforms?

Thanks,
Tim
 
Reply With Quote
 
 
 
 
Spartanicus
Guest
Posts: n/a
 
      01-29-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (EYEBUZZ) wrote:

>If you have a style sheet that is linked from an HTML document AND you have a
>duplicate style sheet actually on the page, meaning some names are the same but
>parameters are different, which takes priority (which does the browsers look
>too for instruction)?


http://www.w3.org/TR/CSS2/cascade.html#cascade

--
Spartanicus
 
Reply With Quote
 
 
 
 
Dylan Parry
Guest
Posts: n/a
 
      01-29-2004
EYEBUZZ wrote:

> Hello,
>
> If you have a style sheet that is linked from an HTML document AND you have a
> duplicate style sheet actually on the page, meaning some names are the same but
> parameters are different, which takes priority (which does the browsers look
> too for instruction)?
>
> Does this change in different browsers/platforms?


The last style defined always takes precedence, unless the !important
keyword is used, which just complicated issues

The general order is something like:

External author's CSS - ie. <link... />
Internal CSS - ie. within <style...></style>
Inline styles - ie. <span style="..."></span>
The user's own stylesheet

HTH

--
Dylan Parry
http://www.webpageworkshop.co.uk - FREE Web tutorials and references
 
Reply With Quote
 
Leif K-Brooks
Guest
Posts: n/a
 
      01-29-2004
Dylan Parry wrote:
> The last style defined always takes precedence, unless the !important
> keyword is used, which just complicated issues


Nonsense. A stylesheet can have this:

#bar {
color : red;
}
..foo {
color : blue;
}

And this will be red, even though blue was defined after red:

<div class="foo" id="bar">Red or blue, Neo?</div>

 
Reply With Quote
 
Dylan Parry
Guest
Posts: n/a
 
      01-29-2004
Leif K-Brooks wrote:

> Dylan Parry wrote:
>> The last style defined always takes precedence, unless the !important
>> keyword is used, which just complicated issues

>
> Nonsense. A stylesheet can have this:
>
> #bar {
> color : red;
> }
> .foo {
> color : blue;
> }
>
> And this will be red, even though blue was defined after red:
>
> <div class="foo" id="bar">Red or blue, Neo?</div>


If you read the OP and my reply you will see that I was not referring to
styles defined within the one sheet or to the complication of using a
class and an id in the same element, but to the general overview - the
last style being defined is the user's stylesheet, which takes precedence.

--
Dylan Parry
http://www.webpageworkshop.co.uk - FREE Web tutorials and references
Now playing: Yes - Give Love Each Day from "Magnification"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
efficient priority queue for a few descrete priority levels Marcel Müller C++ 3 04-27-2009 03:22 PM
D300 BUG in Aperture Priority & Shutter Priority Mode Chico Digital Photography 21 06-23-2008 01:55 PM
Shutter Priority Vs. Aperture Priority Question mutefan@yahoo.com Digital Photography 13 09-14-2006 03:51 PM
Should I use shutter-priority or appurature-priority? ½ Confused Digital Photography 4 02-22-2006 09:48 AM
Question about Aperture priority and Shutter Priority John Edwards Digital Photography 8 01-05-2005 04:58 PM



Advertisments