alias wrote:
Thanks, as you've mentioned, my problem is I don't understand the inheritance rules for cascading. I'm not sure why, for instance, the
.links { font-size: 12px; }
attribute is inherited by my <a> and <p> tags inside the <div class="links">, without specifying a class in <a> or <p>, but the a.links and p.links attributes don't seem to get inherited.
1) Rules are not inherited, only values. So:

.test { border: 1px solid black; color: red }

<p class="test"><span>text</span></p>

the rule is _not_ applied to the <span>. It's applied to the <p> and affects the computed values of the border and color for the <p>. These computed values are what could get inherited.

2) Not all properties' values are inherited by default. If you look at the relevant sections of the CSS2 specification:

http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size :
Inherited: yes, the computed value is inherited

http://www.w3.org/TR/CSS21/text.html#propdef-text-decoration :
Inherited: no (see prose)




Reply via email to