CSS SYNTAX

A CSS statement consists of a selector and a property: value declaration block:
selector { property: value}
Let explain the terms given in the above statement: 

Selector : 

  • The Selector refered to the HTML element which you want to style.
Declaration Block:

  • A 'property : value' combination is known as declaration block.
  • It can be one or more declaration blocks for the css rule. 
  • The Declaration Block consists rule declarations you want to apply on the selector. 
  • All these declarations are saperated by semicolons(;).
  • All the declarations are consist of a CSS property name and a value which is saperated by colon(:).
  • The declarations blocks always appears in the curly brackets {}.
  • All the CSS declaration ends with a semicolon(;) every time.
Let understand above terms by example: 

Suppose we want to style all the anchor tags or links or <a> elements in the web page.


So here,

a will be selector, color will be  property and blue will be the value of the property and color: blue will be a declaraion block. Similarly, font-size: 14px will be another declaration block.

a {
      color: blue;
      font-size: 14px;
}

In the above example all the <a> elements means all the links will have color blue and have the font size of 14 pixels.

Comments