CSS Tutorial

CSS Syntax

We can find a declaration block under a selection in a CSS rule.


If we want to apply CSS styles to an h2 HTML element then the selection will be h2, so the selection will point to the HTML element.

In the declaration block, we can contain single or multiple declarations. We need to use semicolons at the end of each declaration.

In each and every declaration we need to include a CSS property with a value, we can separate them by a colon. 

As we explained we can separate the CSS declarations with semicolons, and the blocks of declaration should be surrounded by curly brackets. 


In the example below, the HTML elements of the paragraph will be aligned center, with a blue text color. 

p {
     color: blue;