2018-10-12 15:37:13 -04:00
---
title: Inherit Styles from the Body Element
---
2019-07-24 00:59:27 -07:00
# Inherit Styles from the Body Element
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Problem Explanation
2018-10-18 00:51:38 +04:00
We need to create a ```h1` `` element with the text ` ``Hello World` ``, then we need to give all elements on your page the color of ` ``green` `` in our ` ``body` `` element's style declaration, and finally, we need add to our ` ``body` `` element font-family of ` ``monospace` ``.
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
## Solutions
2018-10-18 00:51:38 +04:00
2019-07-24 00:59:27 -07:00
< details > < summary > Solution 1 (Click to Show/Hide)< / summary >
**Create a ```h1` `` element with the text ` ``Hello World` ``:**
2018-10-18 00:51:38 +04:00
add ```h1` `` after ` ``</style>` `` element:
2019-07-24 00:59:27 -07:00
```css
2018-10-18 00:51:38 +04:00
< h1 > Hello World< / h1 >
```
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
**Give all elements on your page the color of ```green` `` and font-family of ` ``monospace` `` in our ` ``body` `` element's style declaration:**
2018-10-18 00:51:38 +04:00
add between ```<style>` `` and ` ``</style>` ``:
2019-07-24 00:59:27 -07:00
```css
2018-10-18 00:51:38 +04:00
color: green;
font-family: monospace;
```
2019-07-24 00:59:27 -07:00
**Full solution**
2018-10-18 00:51:38 +04:00
```css
< style >
body {
background-color: black;
color: green;
font-family: monospace;
}
< / style >
< h1 > Hello World< / h1 >
```
2019-07-24 00:59:27 -07:00
< / details >