CSS Syntax

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

Selector in CSS

The selector in css indicates the HTML elements which you want to style and it could be any tag like <h1>, <p> and <h3> etc.

Declaration Block in CSS

The declaration block in CSS can contain the one or more declarations separated by a semicolon(;). For the above example, there are two declarations:

  1. color:green;
  2. font-size:14px;

Each declaration contains a property name and value and it was separated by a colon(:).

Property

A property is a type of attribute of HTML element and it could be color, border and font-size etc.

Value

The value are assigned to css properties which is applied to any HTML Elements. in the above example "green" is assigned to color property.

selector{property1: value1; property2: value2; ..........;}