CSS Syntax

CSS syntax is based on selector and declaration.Selector is basically HTML element while as declaration consists of CSS property 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

  • Step1- Select HTML selector i.e HTML element. Let us select paragraph element(p)
  • Step2-Apply 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{} i.e p{color:red;font-size:20px;}
Example
     h1{ color: blue; text-align: center; }   

Example

Source Code

      
         h1{ color: blue; text-align: center; }      
  

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

Our Tutorials

CSS Syntax
Html Tutorial HTML
Css Tutorial CSS
Bootstrap 5 Tutorial BOOTSTRAP 5
Bootstrap 4 Tutorial BOOTSTRAP 4
Materialize CSS Tutorial MATERIALIZE CSS