CSS Syntax

The basic CSS syntax is shown below.


p 
{
color:red; 
font-size:10px;
}
		


Syntax Explained

The above syntax is explained below using tables.

p {
color:red;
font-size:10px;
}
Selector Declaration

In the declaration part, properties are given value like shown below.

color : blue
Property Value

A working CSS example of the above code is given below.

Example


<html>
<head>
<style>
	p 
	{
	  color:red; 
	  font-size:20px;
	}
</style>
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>
		

Preview

Next Lesson > CSS Selector