CSS Syntax

tutorial and example
tutorial and example

CSS consist of style rules of a selector and a declaration block. It is implemented by the browser. It has three parts : selector, properties and value.

Selector: It is used to indicate the HTML element of the style. The tag could be <h1>, <title> etc.

Declaration Block: It declares the block that can contain one or more declarations deparated by a semicolon.

For the above example, there are two declarations:

Note: Each declaration contains a property name and value, separated by a colon.

Property: It is a type of attribute of HTML element that could be It could be color, border etc.

Value: The values are assigned to the CSS properties. In the above example, value “#8BC34A ” is assigned to color code property.