Advertisement

Advertisement


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">
<head>
<title> CSS Selector </title>
<meta charset="UTF-8">
</head>
<style>
p {
color: red;
text-align: center;
}
</style>
</head>
<body>
<p> Hello World! </p>
<p> This is a simple example of CSS. </p>
</body>
</html>

Output

CSS Selector Example

Hello World!

This is a simple example of CSS.









Become a Patron!

Note: If the updated content is not visible to you please refresh the cookies by pressing CTRL + Shift + R.