CSS Syntax


The most basic element in CSS is the syntax. In CSS syntax, you can see three parts, which are selector, a property and a value. The selector represents the HTML tag, whose property and value of property you want to change.

 

Here is the format for using syntax:

 

selector {property: value}

 

The selector represents the HTML tag, whose property you want to change. When using this syntax format, you need to specify a colon between selector’s property and value. 

 

Example:

 

P

{

text-align: left;

color: blue;

font-family: verdana

}

 
 

Here paragraph is the selector, and you are specifying that properties for the paragraph’s alignment, color and font.

 

You can specify a common attributes for a set of selectors too. Here is an example on this:

 

h1,h2,h3,p

 

{

color: blue

 

}