8.2. Style inheritance

Style settings can have explicit values or they can be left unspecified. If a style setting is unspecified for an element in your document, the element will inherit the style setting from its parent. For example, your document may contain an emphasis element that occurs in a title element. If the color for emphasis elements has not been specified, the emphasis element will inherit the color from the title element in which it occurs.

If the font weight for the emphasis element has been specified as bold, the setting for the font weight would override the settings from the parent element and the content of the emphasis element would appear in the color of its parent element, but in bold face.

Inheritance is based on the hierarchical structure of your document. If a value for a style option has not been specified for an element, the element will inherit the style option from the parent element. If the parent element does not specify the style option, the style option will be inherited from the grandparent of the element, and so on up to the top-level element that encloses the complete document.

If no value for a style option is found for any of the ancestors of an element, the default values will be used. Some of these default values can be adjusted in the Appearance tab of the Preferences dialog (see Preferences).

Each style option is inherited independently. If the parent element of an element specifies the font, but not the color of an element, and the grandparent of an element specifies font and color, then the font will be inherited from the parent element and the color will come from the grandparent of the element. Here is an example of this situation:

<grandparent> <parent> <child>text</child> </parent></grandparent>

The style options for grandparent specify that the content should be displayed in Helvetica with a red text color. The style options for parent specify that Times should be used, but they leave the color unspecified. The style options for child leave font and color unspecified. The child will inherit the font from the parent and the color from the grand parent element.