Dremendo Tag Line

CSS Syntax and its Components

About CSS

In this lesson, we will learn about CSS syntax and its various components.

CSS Syntax

CSS syntax consists of three components and they are:

  • selector
  • property
  • value

The property and value of a selector is written within curly braces. We can apply multiple properties on a selector as shown in the image below.

CSS Syntax

Let's explore each component in detail.



A selector targets HTML elements to apply styles. It can be an element selector, class selector, ID selector, or other advanced selectors.

For example, if you want to apply CSS on a paragraph, you can write CSS as:

p {
    font-weight: bold;

In the above example, p is an element selector, font-weight is a css property and bold is its value. We will learn more about different types of CSS selectors in the next lesson.


A property defines the specific aspect of an element that you want to style. For example color, background-color, font-size, font-weight, etc.


A value specifies the desired setting for a particular property. For example, a value for the color property could be red or #FF0000.