<?xml version="1.0" encoding="utf-8"?>

CSS syntax rules

CSS syntax rules Bad Practice
CSS syntax rules Best Practice

The CSS syntax consists of a set of rules. A rule, in turn, is comprised of 2 parts: the selector and the declaration block. The selector points to the element (or elements) you want to style, and declarations define what style you would like to apply.

For example, here's the rule to style all <h1> headings with the 32px font:

h1 {

font-size: 32px;

}

Each declaration ends with a semicolon (;), and the declaration block must be surrounded by curly braces ({ }).

Improve your UX & Product skills with interactive courses that actually work