CSS Syntax?


CSS Syntax

A CSS Syntax style rule is made of three parts −

  1. Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like or etc. Selector indicates the HTML element you want to style. It could be any tag like etc.and also The selector points to the HTML element you want to style.

  2. Property − A property is a type of attribute of HTML tag.It could be color, border etc. and also Put simply, all the HTML attributes are converted into CSS properties. They could be colorborder,size,background-color,height,width etc. 

  3. Value − Values are assigned to properties. For example, color property can have value either red or #F1F1F1 etc.

  4. The declaration block -contains one or more declarations separated by semicolons.Each declaration includes a CSS property name and a value, separated by a colon.

    A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces. 

    You can put CSS Style Rule Syntax as follows −

      selector { property: value }

          A CSS rule-set consists of a selector and a declaration block:



CSS selector




Related Topics