You are here: Re: CSS Question « HTML « IT news, forums, messages
Re: CSS Question

Posted by City Dweller on 11/27/54 11:56

David,

Thanks for responding.

That is not what CSS specs say, though. Here is quote from
http://www.w3.org/TR/REC-CSS1:

<<QUOTE>>
A declaration in the 'STYLE' attribute of an element has the same
weight as a declaration with an ID-based selector that is specified at
the end of the style sheet:

<STYLE TYPE="text/css">
#x97z { color: blue }
</STYLE>

<P ID=x97z STYLE="color: red">

In the above example, the color of the 'P' element would be red.
Although the specificity is the same for both declarations, the
declaration in the 'STYLE' attribute will override the one in the
'STYLE' element because of cascading rule number 5.
<<END OF QUOTE>>

Note that the specificities are the same (100 in both cases). However
if you change from #x97z to P#x97z the specificity of color:blue should
now be 101 and thus greater than color:red.

So these specs are incorrect then?

-- CD




David Woods wrote:
> "City Dweller" <dc_dweller@hotmail.com> wrote in message
> news:1156536935.284283.171710@p79g2000cwp.googlegroups.com...
> > Hello everyone,
> >
> > Hope someone can explain this to me....
> >
> > <style>
> > h1#jo { color: red }
> > </style>
> >
> > <h1 id="jo" style="color: yellow">ABC</h1>
> >
> > All browsers display ABC in yellow. Why? According to CSS specs, the
> > specificity of "color: yellow" is 100 since it is a STYLE attribute
> > inside a tag. However, the specificity of "color: red" is 101, a = 1
> > for #id, b = 0, and c = 1 for h1.
> >
> > So I would think ABC should be red not yellow. Where is the flaw in my
> > calculations?
> >
> > Thanks.
> >
> > -- City Dweller
> >
>
>
> Inline style takes precedence over internal style sheet which in turn takes
> precedence over external style sheet.
>
> --
>
> David

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация