CSS Syntax


A CSS style sheet is a combination of several style definitions, each style definition having two main components.

Selector: The selector indicates the HTML element to which you want to apply the style. It could be any tag such as, etc.

Declaration: The declaration components are separated with semicolons. The declaration component has two components. such as property name and value.

Property: A property is an HTML element attribute type. It can be color, border, etc.

Value: The value is the property value. It can depend on the property.

Syntax

Selector { Property:Value;}

Example

h1 { color:red;}