CSS Syntax


A CSS rule consists of a selector and a declaration block.

CSS Syntax

The selector shows which part of a webpage you want to design.

The group of statements inside curly braces has one or more statements separated by semicolons.

Every statement has a name for a style and how it looks, with a colon between them.

CSS uses semicolons to separate different statement for styling, and when you want to group several statement together, you put them inside curly braces.

Example Explained

  • In CSS, we use p to select a specific part of an HTML page for styling. It's like pointing at the part you want to make look nice, such as a style: <p>).
  • color is a property, and red is the property value
  • text-align is a property, and center is the property value