Tutorials & Script Homepage
Style Sheets 7to13
Syntax: Part 1
Syntax: Part 2
Syntax: Part 3
Syntax: Part 4
Different Types of Style Sheet
CSS Shorthand
Style Inheritance
advertisment
advertisement
advertisement
Host With Us: HostingHelper.co.uk From Only $5.00p/m
Spotted an Error ? Let us Know
100's more FREE templates at FreeWebTemplates
Looking for a new Web Host ?
Free templates from TemplatesLand
Professional High-End Templates
TemplateBox.com more FREE templates
Free Flash Templates and Intros
advertisement
 
STYLE SHEETS NUMBER : 13
Please Click Here, and Help Keep This Site FREE to Use
 
Please click on our sponsors advert to the right if you download or use anything from this page.
Thank you for your help.

Style Inheritance

HTML documents are structured hierarchically. There is an ancestor, the top level element, the HTML element, from which all other elements (children) are descended. As in any other family also children of the HTML family can inherit their parents, e.g. color or size.

By letting the children inherit their parents a default style can be created for top level elements and their children. (Note: not all properties can be inherited).  The inheritance starts at the oldest ancestor and is passed on to its children and then their children and the children's children and so on.

Inherited style can be overridden by declaring specific style to child element.  For example if the EM element is not to inherit its parent P then own style must be declared to it. For example:

	BODY {font-size: 10pt}
	All text will be displayed in a 10 point font
	
	BODY {font-size: 10pt}
	H1 {font-size: 14pt} or H1 {font-size: 180%}

All text except for the level 1 headings will be displayed in a 10 point font. H1 will be displayed in a 14 point font (or in a font that is 80% larger than the one set to BODY). If the element H1 contains other elements, e.g. EM then the EM element will also be displayed in a 14 point font (or 180%) it will inherit the property of the parent H1. If the EM element is to be displayed in some other font then own font properties must be declared to it, e.g:

	BODY {font-size: 10pt}
	H1   {font-size: 14pt} or H1 {font-size: 180%}
	EM {font-size: 15pt} or EM {font-size: 110%}

The EM element will be displayed in a 15 point font or will be 10% larger than H1 . NOTE:EM is, in this example, inside H1 therefore will inherit H1's properties and not BODY's.

The above declaration will display all EM elements in 15 point font or font that is 10% larger than font declared to the parent element. If this specific font is to apply to EM elements but only if they are inside H1 and not every occurrence of EM then EM must take a form of a contextual selector.

	H1 EM {font-size: 15pt} or H1 EM {font-size: 110%}

In the example above EM is a contextual selector. It will be displayed in specified font only if it will be found in the context of H1

Not all properties are inherited. One such property is background . However, since it's initial value is transparent the background of the parent element will shine through by default unless it is explicitly set.

Web Hosting  |  Membership website templates  |  Reliable UK Web Hosting  |  asp.net web hosting  |  Art Web Templates  |  Cheap Flight Deals  |  Free Web Hosting  |  UK Web Hosting Company  |  Coursework Writing  |  Reseller Hosting  |  tarot  |  Cheap UK Web Hosting  |  Fitness Blog  |   cell phones  |  Web Design  |  Low Cost Domain Names  |  ASP.NET Hosting  |  Website templates  |  cursos informatica  |  tienda informatica online  |  UK Link Directory  |  Austin Web Design  |  Flash Templates  |  Factory  |   Canada Web Hosting  |  Flash Intros  |  Web Templates  |  website designers  |  cheap web hosting  |  Resume templates  |  Corporate Logo Design Service  |  Bathroom Shower  |  website hosting rating  |  Website Templates  |  Bespoke Software Development  |  Domain Name Registration  |  Free Website Templates  |  web hosting services  |   Dedicated Server  |  UK Web Hosting  |  Dating Software - aeDating 4.1  |  Flash Templates  |  Website Templates  |  Power Saver  |  China Wholesale  |  Flash templates  |  cctv cameras  |  Web Hosting Companies  |  Lolita Dresse  |  china wholesale  |  Sharepoint Hosting  |  Canadian Web Hosting  |   Cheap Web Hosting Deal  |  Linux Hosting  |  Web Design uk  |  Web Hosting  |  Business web directory  |  Electronics  |  Free domain names  |  Best UK web Hosting  |  Shower Enclosures  |  

 
advertisment
advertisment
advertisment
advertisment
  Top-end templates
  Flash Templates
  Web Hosting UK
  Made-in-China.com
  Web Design Tips
  Link Bid Directory
  Web Hosting
  Web hosting reviews
  Website Design
  eCommerce Web Design
  Top web hosting
  Stock Photography
  Bildagentur
  Web Design
  Reseller Hosting
  SEO Services India
  Company Logos
  Website Templates
  Website Templates
  Web Hosting UK
  templatebox.com
  freewebtemplates.com
  templatesland.com
  topfreegraphics.com
  freegraphicland.com
  free-templates-layouts
  Logo Design Software
  Layouts4Free
  Webmaster Resoucres
  Web Templates Factory
  Free Web Templates
  Free Templates Catalog
  Web Templates
  Reseller Web Hosting
  Stock Photography
  Animations-galore.com
  4print.com.au
  Host Review
  Web Hosting Host Color
  Dedicated Servers
  FlashTemplateDesign
  ZeroDollarTemplates
  Killersites.com
  how-to-build-websites
  Build a free website
  web Hosting
  Business Logo Design
  Templates Favpage
  webmastermind.de
  flasheasy.com
  More Featured Sites