CSS Syntax

A CSS rule-set consists of a selector and a declaration block:

CSS Syntax

Selector : A Selector is any HTML element we want to style, like <p>, <div> etc.
Declaration Block: This block contains the different properties and their values which we want to change in the selector element. Example : -
  1. color:yellow;
  2. font-face:arial;
Property: A Property is kind of a quality of any HTML element like color, border, font-size etc. which will change the appearance and style of it.
Value: Every CSS property has a value which will give different results for a particular property. In the above example, value yellow is assigned to color property.

<!DOCTYPE html>
<html lang="en">
<title> CSS Selector </title>
<meta charset="UTF-8">
p {
color: red;
text-align: center;
<p> Hello World! </p>
<p> This is a simple example of CSS. </p>


CSS Selector Example

Hello World!

This is a simple example of CSS.

Follow Us: