Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / August 2008



Tip: Looking for answers? Try searching our database.

CSS classes rendered differently than in-line CSS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
yawnmoth - 27 Aug 2008 21:00 GMT
http://www.frostjedi.com/terra/scripts/demo/trtd.html
http://www.frostjedi.com/terra/scripts/demo/trtd2.html

Why don't those look the same in Firefox?  The latter is the rendering
I'd expect for the first one, as well.  The only difference is that
what's defined in-line in the second link is defined via a CSS class
in the first.
Harlan Messinger - 27 Aug 2008 21:53 GMT
> http://www.frostjedi.com/terra/scripts/demo/trtd.html
> http://www.frostjedi.com/terra/scripts/demo/trtd2.html
[quoted text clipped - 3 lines]
> what's defined in-line in the second link is defined via a CSS class
> in the first.

Because a style set directly on an element has higher specificity than
stylesheet rules that match the element (in other words, the
directly-set style takes priority over the ".demo td" selector in the
inline stylesheet), while the ".demo td" selector has greater
specificity than the ".test" selector, the former consisting of a class
selector compounded with an element selector, while the latter consists
of only a class selector. See

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

for details. From there, you will see that the style attribute has
specificity 1,0,0,0, the ".demo td" selector has specificity 0,0,1,1,
and the ".test" selector has specificity 0,0,1,0.
Andreas Prilop - 28 Aug 2008 15:14 GMT
> See
> http://www.w3.org/TR/CSS21/cascade.html#cascade
> for details.

Or, more specifically,
http://www.w3.org/TR/CSS21/cascade.html#specificity

But this is different from
http://www.w3.org/TR/REC-CSS2/cascade.html#specificity

What do browsers actually do?

For a small demonstration that relies only on CSS1 and
that does not use the STYLE attribute, see
http://www.unics.uni-hannover.de/nhtcapri/cascading-order.html
http://freenet-homepage.de/prilop/cascading-order.html

Signature

Solipsists of the world - unite!

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.