CSS Syntax

CSS syntax is based on selector and declaration. The selector is basically an HTML element while as declaration consists of CSS property and value separated by a colon(:) and each declaration ends with a 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;}

General Syntax

Try it now

Source Code

          h2 {
  color: blue;
  text-align: center;
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

Web Tutorials

CSS Syntax
Html Tutorial HTML
Javascript Tutorial JAVASCRIPT
Css Tutorial CSS
Bootstrap 5 Tutorial BOOTSTRAP 5
Bootstrap 4 Tutorial BOOTSTRAP 4