Monday, September 17, 2007

Multiple Styles Will Cascade Into One


Style sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.

Cascading Order

What style will be used when there is more than one style specified for an HTML element?

Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:

  1. Browser default
  2. External style sheet
  3. Internal style sheet (inside the tag)
  4. Inline style (inside an HTML element)

So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style declared inside the tag, in an external style sheet, or in a browser (a default value).

2 comments:

vikas saini said...

Hey,
your work is great
keep it up!
i'm in graphic field
but ur work
inspire me to
work for on web.
god bless u.

Vijayta Panchal said...

Thanx Vikas for Ur kind words