Example of css inherit keyword

css

Solution

Let's say we want all of our anchor text to be orange:

a { color: orange }

And we want all of our div text to be green:

div { color: green }

What if we want anchors within divs to also be green? Here, we can use inherit:

div > a { color: inherit }

The following HTML snippet might make this clearer:

<a href="#">I'm orange</a>
<div>I'm green!</div>
<div>I'm green and <a href="#">green</a>!</div>

Problem

What is an example of needing to use the inherit keyword in css?

Original source