If we talking about CSS syntax, it’s a set of rules or a combination of selector and declaration block.

CSS Syntax as given −

selector { property: value }

In the given figure you can see: Selector

CSS syntax

inside the blue circle, all these are called selectors. All selectors are HTML tags and you can apply style on them.

what is CSS Syntax

Declaration: Every declaration contains CSS property and value. The declaration block contains one or more properties and values, which are separated by semicolons. See the above figure.

Example#1 In the given example all <p> text will be an increase in size and the text color will be black.

p {
font-size: 12px;
color: #000;

In above example, where

  • p is the selector or HTML tag
  • font-size, color are the properties and
  • 12px, #000 are the values

Pin It on Pinterest

Share This