CSS Tutorial

Selectors

To start writing CSS, you first write a selector that will be used to target one or more certain HTML elements.

    

selector


    

The selector is followed by a pair of curly braces.

    

selector {

}


    

Properties and values

Inside the curly braces, you can put a property, followed by a colon, the value, and a semi-colon. The whole thing is called a CSS rule.

    

selector {
  property-name: value;
}


    

Some properties can take more than one value.

    

selector {
  property-name: value value;
}


    

You can put more than one property inside the curly braces.

    

selector {
  property-name: value value;
  property-name: value;
}


    

You typically have multiple CSS rules in one file. They are usually separated by one blank line.

    

selector {
  property-name: value value;
  property-name: value;
}

selector {
  property-name: value;
}