Code Editor
Web Browser
Basic CSS Structure & Syntax

Review: CSS Basic Structure & Syntax

Great work! You've learned the basics of CSS structure and syntax. We'll continue to build on these basics as you learn more about CSS.

Let's review what you've learned so far:

1. A CSS selector targets an HTML element.

2. CSS declarations style HTML elements. Declarations must contain the following two things:

  • property - the property you want to style.
  • value - the value for the property you are styling.

3. CSS declarations must end in a semicolon (;)

4. A CSS rule consists of a CSS selector and the declarations inside of the selector.

5. Multiple element selectors can be used to style multiple elements at once.

6. Comments keep code easy to read and allow you to experiment with new code without having to remove old code.

7. CSS follows certain best practices for spacing and indentation:

  • One line of spacing between a selector and the opening curly brace.
  • No spacing between CSS declarations and the opening and closing curly braces of the CSS rule.
  • Two spaces of indentation for CSS declarations.
  • One line of spacing between CSS rules.

If you're up for it, take some time to experiment with your new CSS syntax knowledge in style.css.

We've cleared your previous CSS rules to give you a fresh start. You'll also note that index.html and style.css have already been linked for you. When you're done experimenting, you can proceed to the next unit.

Report a Bug
If you see a bug or any other issue with this page, please report it here.