Inherited definitions

Where certain attributes are not defined for a particular tag and the tag doesn't have a default value for the tag the the tag will inherit the same value for the attribute as is defined (or default) fro the next tag out that the tag is nested within. If it isn't defined for that tag either then the search for a value to use will continue up the various levels of nested tags until a value to use is found. In effect the attributes associated with the body tag of your page will be inherited by all of the tags within your page unless either those nested tags have their own default value or you have overridden the values in your stylesheet.

Not all attributes are inherited though. So how do you know which attributes will be inherited and which ones wont? Well in most cases all you need to do is to ask yourself whether it would make sense for that attribute to be inherited. If it makes sense for the attribute to be inherited then it probably will be. If it doesn't make sense for the attribute to be inherited then it probably wont be. If in doubt you can always look t up in a reference list, test it for yourself in several browsers to see what it does, or simply make sure that you code the necessary attributes as part of the appropriate definitions in your stylesheet.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow