21.4. Exercises: CSSΒΆ

We have built a website for you to test your CSS knowledge. Check out the repl.it!

For the exercises, add the following style rules to the website:

  1. Change the background color to yellow.

    Check your solution.

  2. Change all paragraph text color to green.

  3. Change all h1 to 36 px font size.

    Check your solution.

  4. Align all text to the center of the page.

  5. Let's say that you don't like aligning all of the text to the center. Use a CSS class to align only the headings to the center of the page.

    Check your solution.

  6. Change the font color of elements with the id, cool-text, to blue.

  7. Use a CSS id to change the elements in the ordered list to a color of your choosing.

    Check your solution.

Note

We learned from the reading that the location of CSS and the selector type can change the order of precedence of the CSS rules. Try different locations and selector types and see what happens!