You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jonathan edited this page Jun 19, 2023
·
5 revisions
CSS exercises
Exercise 5: background-color
selector{property: value;}
Instructions
Let's write some CSS rules to change the background color of some of our elements! First, create a style element (<style>...</style>) inside your head element. Then:
Set the header element's background-color to mediumvioletred.
Set the background-color of your section elements to lightgrey.
Set the background-color of your main element to goldenrod.
Hints
Follow the CSS syntax pattern: selector { property: value; }. For task 1, this means: use header as the selector, background-color as the property and mediumvioletred as the value.
Code snippets
Adding a style element and the solution for task 1 (the other tasks follow this pattern).
<!DOCTYPE html><html><head><style>header{background-color: mediumvioletred;}</style></head><body><!-- body content --></body></html>