Inherit Styles from the Body Element

Tell us what’s happening:

Your code so far

<style>
  body {
    background-color: black;
  }
  .green {
    
  }
</style>
<h1 color="green">hello world</h1>

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/inherit-styles-from-the-body-element

Hi.
In this challange main thing is “inherit styles”.
Inheritance means in this case - body is parent of h1 and h1 can take styles like color, background, font-size, font-family. Check more info here
Other words if you define
body {
color: red;
}
then
h1
will take color: red; automatically.
But if you define
h1{
background-color:green;
}
then body will not accept style rule background-color: green;.It will be defaul #fff

So lets take a look at your code. We need make h1 color: green but not define inline style like h1 color=“green” .
So we can define
body{
font-family: Monospace;
color: green;}
for body. Then h1 will take style font-family:Monospace;. and color: green;

Feel free to ask a questions.
Best rigards.

Thank you for explaining the formula, it was extremely helpful.It cleared up a lot for me. :smile: