CSS Syntax

Concept Behind CSS Syntax

CSS syntax is based on selector and declaration.Selector is basically HTML element while as declaration consists of CSS proverty and value separated by colon(:) and each declaration end with semicolon(;),and the declaration groups are surrounded by curly braces {}.

Step To Write CSS Syntax

  • Select HTML selector i.e HTML element. Let us select paragraph element(p)
  • Apply the CSS declaration rule on the HTML selector. Declaration rule is basically CSS property and value that is separated with a colon(:) and each declaration ended with a semicolon and all the declaration statement exists within curly braces{}. p{color:red;font-size:20px;}



Source Code

Try it now

Code Explanation

Note: In the above example, how to write CSS syntax is described.CSS declaration rule is basically proverty and value pair that is separated with colon(:) and each declaration end with semicolon and all declaration rule is mentioned inside curly braces{}.

Online Test / Quiz