From the course: CSS: Inheritance, Specificity, and the Cascade

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Controlling inheritance with inherit

Controlling inheritance with inherit - CSS Tutorial

From the course: CSS: Inheritance, Specificity, and the Cascade

Controlling inheritance with inherit

- [Instructor] We know that some properties inherit while other properties do not. Is it possible to make properties inherit or is it possible to turn off the inheritance? So here's my beginning code pen. You'll find a link for this in your exercise files. And the thing you should know as we get started is that inherit is a value, not a property. So let's see how that works in our code pen. And continuing here with our previous example, we put a border all the way around this div, that's right here on our div-id style. We know that this border doesn't inherit, otherwise we'd have borders around all of those HTML elements. But we can force that inheritance to happen. So here on my paragraph, I could, for example say, border inherit and we will wind up with borders on our paragraphs. Now that border property will be inherited from div-id. That's because these paragraphs are children of that particular div. So that's…

Contents