CSS Tutorial Series

CSS tutorial : Syntax

Pug tutorial series pugjs tutorial introduction

Inside this article!

  1. Syntax


Every language comprises of some certain set of rules which defines the syntax of that language. In the same way CSS is also comprised of certain rules which are applied on HTML. These rules are then interpreted by web browsers which perform the operations (like changing font size, changing color of a certain element) accordingly.
CSS rules always consist of a Selector and Declaration & each declaration further consists of property and value separated by colon(:) as shown below:

CSS syntax

Style rule in CSS consist of following :

  • Selector : It is an HTML tag on which style will be applied. we have many types of selectors which are explained in detail in the next chapter.
  • Declaration : Declaration block contains declarations separated by semi-colon(;). Each declaration block in CSS contains :
    • Property : Attribute of an HTML tag as shown in example above.
    • Value : They are assigned to properties as shown in the example above.