Library tutorials & articles
Using Cascading Style Sheets (CSS)
Inheritance of Styles
When a style is defined for a tag, the specified properties override the existing
properties for that tag. The properties that the original tag had that were
not overridden, are inherited into the new style. The following example applies
a style to the <h1> tag so that the text is right aligned. If no other
style has been specified for the <h1> tag then the browser's default
font size, font face, colour, etc is used with the style.
<h1 style="text-align:right">Right-Aligned Text</h1>
Order of Inheritance
The order of inheritance is the same as that of priority. Inheritance within
style sheets can be thought of as an inheritance tree consisting of the inline
styles, the style sheet in the <head> of the HTML document, and the external
style sheet. Any of the styles may be missing, in which case the style above
is inherited.
- An inline style is inherited from the style defined in the <head> of the document if one exists.
- Styles defined in the
<head>of the document are inherited from the external style sheet if one exists. - Styles defined in the style sheet are inherited from the browser.
If a style is missing within the inhertance tree, the style is inherited from
the style above. For example, If there is no style specified in the <head> of
the document or an external style sheet, the style for the <h1> tag defined
above would inherit the other properties for <h1> from the browser. If
all properties for the tag are overridden, then no inheritance will take place.
Related articles
Related discussion
-
Create this kind of website
by maidentv (1 replies)
-
$200 Website Design and Development
by manypeopledesign (1 replies)
-
Dallas Interactive Marketing & Internet SEO SEM October Meetup
by dsafmx (4 replies)
-
Contract: ActionScript/FlashBuilder Developer
by mattmeigs (2 replies)
-
Can I design web site by using ASP.net
by pradeepfusion (1 replies)
Related podcasts
-
Despise the listener
We have a great lineup this week: Paul talks about getting things done in web design and an alternative approach to your reading list. Marcus explains the exciting area of insurance for web designers and we have Andy Clarke on the show to give us an update on CSS 3.
Events coming up
-
Nov
23
Dan Cederholm Workshop
London, United Kingdom
Handcrafted Bulletproof CSSwith Dan Cederholm of "Simplebits"Learn how craftsmanship can apply to the intangibility of web design. Dan Cederholm will guide you though a case study, pointing out the details that matter most when designing fle...
This is a good tutorial as it covers the basics.
Nevertheless, readers should know that CSS can be taken to the extreme and should know the other side of the story in regards to fully integrated CSS.
One of the points to always remember in any technology is the K.I.S.S. principle.
Tables versus fully CSS (i.e. replacing all table tags with div tags)
http://www.decloak.com/Products/Dreamweaver/NestedTemplates/TablesOrLayers.aspx
This thread is for discussions of Using Cascading Style Sheets (CSS).