This course has been updated! We now recommend you take the Complete Intro to Web Development, v3 course.

Check out a free preview of the full Complete Intro to Web Development, v2 course:
The "Parents and Children" Lesson is part of the full, Complete Intro to Web Development, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Brian reviews CSS inheritance, which is when an HTML element transmits its CSS rules to a child element.

Get Free Access Now

Transcript from the "Parents and Children" Lesson

[00:00:00]
>> Brian Holt: So parents and children. So something first I want to tell you is you would typically call <div> here, the parent of <h1>. It's because it encapsulates. So that relationship is called <div> is the parent, <h1> is the child. And if I had one above <div>, like maybe there was a section above <div> here, you would call that it's ancestor, right?

[00:00:24] Cuz it's even further that a parent.
>> Brian Holt: And then, if h1 had another paragraph next to it, it would be its sibling. I'm not making this up, that's what people call it.
>> Brian Holt: So if I have a selector that says div, which is this one out here. Because this h1 is inside of the div, and I'm assuming that h1 has nothing affecting it, right?

[00:00:52] This h1 will be blue. So the parent selectors will affect the children.
>> Brian Holt: For the most part. It depends on the property. But in this particular case, this color will permeate all of the div inside of it.
>> Brian Holt: Does it make sense?
>> Brian Holt: Cool.
>> Brian Holt: So I have a ridiculous one right here.

[00:01:12] If I have body, and then I have bunch of divs inside of it. And this h1 inside of it. And I say body color:orange, this h1 will be orange. So something to keep in mind. That'll work for most of the font ones, like font family, which is how you change is this Helvetica or Arial, or what kind of font it is.

[00:01:33] Those sorts of things.
>> Brian Holt: Cool, so that's a basic primer into CSS, CSS properties, and CSS selectors.