CSS: Inheritance


Each element inherit the property of parent element. Let's see:

h1 {color : blue}

That's, you are saying to the browser (called parser or U.A., User Agent) that all <h1> elements will be rendered blue. Well, if you say now:

<h1>This is a line<em>very<em>cool</h1>

What's happen? If you have not defined the color of <em> tag, it will inherit the color of the parent element (<h1>). So it will be rendered blue. Look at this example:

<html>
<body>
<p>
<h1>
</h1>
</p>
</body>
</html>

Well

<h1> is a tag and. <p> is its parent
<p> is a tag and
<body> is its parent
<body> is a tag and <html> is its parent

However, some properties are not inherited from the parent element. It's ok. For example, borders properties aren't inherited.


Index           Home  Back       About  Contact us!

Copyright (c) 1998-2006 Wowarea