Previous Next

CSS Syntax

A CSS rule syntax consists of three components: a selector, a property, and a value for the property. The selector refers to the HTML element in which the CSS style is to be used. Semicolons are used to separate the CSS properties.

Syntax:

selector {
    property: value;
}

Example:

h1 {
    color: aqua;
}

Explained the example

CSS declarations consist of a property name and value, separated by a colon (:) and surrounded by curly braces ({ }).

Previous Next