CSS Syntax

Like HTML and other computer languages, Syntax is also used to write CSS Rules. Through which CSS Declarations are written for HTML Document.CSS Syntax is also called Style Rule. The Style Rule mainly consists of two parts.

Selector – A Selector is a word / set of words / letters for which a ‘Style Rule’ is written. It is written outside ‘Curly Bracket’. This is usually the HTML Tag. But, it can be written by giving any name. Yes, you read any name correctly, but you will learn it in the following Lessons.

  • Declaration – Declaration Style is the part of the rule in which the style for a Selector is announced. It also has two parts.
  • Property – Property Style is the part of the rule that style we want to apply to a ‘Selector’. It is written inside the Curly Bracket. It can be considered as an Attribute of HTML Tag.

Value – The third part of the Style Rule is the value. It is also written within Curly Bracket. In this, the value is set for the property. The “What” of the Property Selector is the same value called “How”.

CSS Syntax Rule :-

p {
color: green;
font-size: 14px;
margin-top: 25px;
}

Leave a Reply

Your email address will not be published. Required fields are marked *