Jump to content

Lame question. What does "inherit" mean?


psypent81

Recommended Posts

Ok, lame newbie question.What does the value of "Inherit" mean? I have a CSS book that assume I know what that means in terms of CSS. Can anyone give me a quick explanation of the meaning?I would really appreciate it.Thanks-psypent

Link to comment
Share on other sites

Here's a concrete example for you regarding inheritance:

<html><head><style>.red { color: red; }</style></head><body><div class="red"><p>Here is a paragraph.</p><ol>  <li>An ordered list.</li>  <li>With two elements</li></ol></div></body></html>

If you want all of the elements (the <p></p> and the <ol><li></li></ol>) to have the same style as the parent element (the <div></div>), you can set the style for the parent element and it will be inherited by the child elements (i.e. they are all red in this example).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...