Codecademy

Sign In Create Account
01/03
Background color, height, and width

Remember our friend <div>, and how we used it to make those multi-colored blocks? Time for you to build your own blocks! (Well, block. Let's not get ahead of ourselves.)

There are three properties you'll need to set values for:

  1. background-color, which you set to a color or hex value
  2. height, which you set to a value in pixels
  3. width, which is also measured in pixels

These exercises will give you a brief overview of the different HTML elements you can select and what some of their property-value pairs are (like the new ones we mention above). We'll cover HTML element selection more in the next course!

In the stylesheet.css tab:

  1. Set the background-color to #cc0000, like this: background-color: #cc0000;
  2. Set the height to 100px, like this: height: 100px;
  3. Set the width to 100px, as well.
Stuck? Get a hint!Hint

Make sure you're using background-color for your <div>, not color!

Save & Submit Code Reset Code View Preview
Back to editor
Back to editor
FULL PREVIEW

Start Here

Each lesson starts here. Read the explanation, then follow the instructions underneath. If you get stuck, you can click on the "Hint" for help.

Enter your Code

Type your response to the instructions here, in your code editor.

See What it Does

Here's where you can see how your code will render in your browser. This will update as you type.

Submit!

Ready to see if your code does what it should? Click "Save + Submit" to check your code!

Click "Save + Submit" to run your code! Your code’s output will pop up on the screen.

Sign in to Codecademy