Determining Cascade Order in DHTML


Within a single web page there may be style sheets linked, imported, embedded or in-lined. Some browsers eventually plan to allow users to have their own style sheets (like altering defaults in the Windows interface). User specific style sheets can ultimately be used to override the web page author's style sheets. This is why they are called Cascading Style Sheets.

There is an attribute called the !important attribute. Thus any property flagged as being !important will get priority for display. Obviously an author's style sheets will override a visitor's style sheets unless the visitor uses the !important attribite.

In general the more specific a rule is the higher its cascade priority will be. In determining priority of selectors ID selectors have a priority of 100, classes of 10 and HTML selectors of 1. If all else fails CSS gives priority to the last rule listed. This is useful where the requirement is for inline rules to override rules listed in the document <HEAD>.