Test your skills: Values and units
The aim of this skill test is to assess whether you understand different types of values and units used in CSS properties.
Note: You can try solutions in the interactive editors on this page or in an online editor such as CodePen, JSFiddle, or Glitch.
If you get stuck, you can reach out to us in one of our communication channels.
Task 1
In this task, the first list item has been given a background color using a hex color code. Your task is to complete the CSS using the same color in different formats, plus a final list item where you should make the background semi-opaque.
- The second list item should use RGB color.
- The third should use HSL color.
- The fourth should use RGB color but with the alpha channel set to
0.6
.
You can find conversions for the hex color at this link. You need to figure out how to use the values in CSS. Your final result should look like the image below:
Try updating the live code below to recreate the finished example:
Download the starting point for this task to work in your own editor or in an online editor.
Task 2
In this task, we want you to set the size of various items of text, as described below:
- The
<h1>
element should be 50 pixels. - The
<h2>
element should be 2em. - All
<p>
elements should be 16 pixels. - A
<p>
element that is directly after an<h1>
should be 120%.
Your final result should look like the image below:
Try updating the live code below to recreate the finished example:
Download the starting point for this task to work in your own editor or in an online editor.
Task 3
In this task, we want you to move the background image so that it is centered horizontally and is 20% from the top of the box.
Your final result should look like the image below:
Try updating the live code below to recreate the finished example:
Download the starting point for this task to work in your own editor or in an online editor.