WEEK: 7
Active: September 28th - October 4th
Work Due: October 5th @ 11:59PM

Basic Structure of CSS

Basic Structure Video

In its most basic form, CSS looks like this.

selector

The description is as follows.

  1. The selector points to the HTML element you want to style.
  2. The declaration block contains one or more declarations separated by semicolons.
  3. Each declaration includes a CSS property name and a value, separated by a colon.
  4. End CSS declarations with a semicolon
  5. Surround declaration blocks by curly braces

source - w3schools.com

For example, you might have a style that looks like this.


body {
  bgcolor: pink;
  text-align: center;
}

  1. body is the selector
  2. bgcolor and text-align are part of the declaration and is the CSS property name. The declaration block contains the declarations separated by a semicolons important!. { } braces surround the declaration block.
  3. Finally, pink and center are also part of the declaration but are the values of the properties.

Previous section:
Next section: