What sorts of things can child elements inherit from their parents?

Question

This exercise says that child elements can inherit from their parents. What sorts of things can child elements inherit from their parents?

Answer

When you dive into our CSS course you will learn that child elements inherit most of their styling from their parent elements. In other words, most styles cascade down from parents to children.

25 Likes

I understand about the styling part, but what about the behavior that is mentioned in the lesson ?

3 Likes

Moreover, the relationship parent, child, and sibling is important to manipulate
HTML elements via Javascript language. For example, If you understand that the parent of this list of items is ul element, you can add one more item within it when a user clicks a button on your web page.

<ul>
  <li>Walk my dog</li>
  <li>Buy some milk</li>
  <li>Finish math homework</li>
</ul>

Please keep learning HTML and CSS. They are very important. Then, you can adventure to Javascript.

12 Likes

Sticking to this family illustation, if childen elements inherit from their parents, can they also inherit from grandparent elements, like children can inherit from their grandparents in real life? :smiley:

4 Likes

yes. The vocabulary is just to demonstrate the path of cascading. Make sure to understand which attributes will take precedence.