Awesome job! Now main.css is linked to index.html. Before we start writing our own CSS, let’s take a look at how CSS code works.

The diagram to the right shows the anatomy of a CSS rule:

  1. rule: a list of CSS instructions for how to style a specific HTML element or group of HTML elements.

  2. selector: specifies exactly which HTML elements to style. Here h1 is the selector.

  3. properties and values: located inside the { } brackets, properties and values specify what aspect of the selector to style. In the diagram’s example, the color property is set to red, which will display all h1 elements in red.

Click Next to continue.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?