[Prev][Next][Index][Thread]

Style attribute on element == ID?



Neil Galarneau writes:

 > Is a style attribute on an HTML element equivalent in weight to an
 > ID on that element?

The CSS1 spec [1] says:

 "A 'STYLE' attribute on an element (see section 1.1 for an example)
  should be considered as if an ID attribute had been specified at the
  end of the style sheet."

If two declarations have the same weight, the latter specified will
override the first one (cascading rule #5). Therefore, the STYLE
attribute will override a declaration with an ID-based selector.

So, STYLE wins.

-h&kon

Hakon W Lie, W3C/INRIA, Sophia-Antipolis, France
http://www.w3.org/people/howcome  howcome@w3.org


References: