/    /  CSS Syntax

CSS Syntax

 

A CSS stylesheet provides a set of rules that are interpreted by the web browser and then applied to the corresponding elements and the CSS rule set contains a selector and a declaration block.

 

CSS Syntax

 

Selector:

 

The HTML element you want to style, It could be any tag like <h1>, <title>, <P>, etc.

 

Declaration Block:

 

The block contains one or more declarations separated by a semicolon. For the above example, there are two declarations.

  1. color:blue;
  2. text-align:center;

Every declaration includes a CSS(style) property name and a value, separated by a colon.

 

Property:

 

It is a type of attribute of the HTML element. It could be color, border, etc.

 

Value:

 

Values are assigned to CSS properties. In the above example, the value “blue” is assigned to the color property.

 

SYNTAX:

 

Selector{Property1: value1; Property2: value2; ..........;}