Jump to content

Lame question. What does "inherit" mean?


Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...