CSS Syntax (Rule)
CSS Syntax
Syntax usually refers to the rule that we gonna write the code, It is also considered as the grammar to write a perfect line of code.
We will discuss the syntax of CSS (Cascading Style Sheet) in the remaining part.
Syntax
The syntax of CSS involves a SELECTOR and a DECLARATION block.
- Selector points to the change in an HTML element that we want to style.
- A declaration is a change that will be implemented in the HTML element.
- Declarations block consists of one or more declarations separated through (;) Semicolon.
- Each declaration is separated through a colon that contains a Property and a value, as shown in the image above.
- The whole Declaration block is enclosed by Curly braces.
Example:
Example Explained
pis a selector in CSS (it points to the HTML element you want to style: <p>).coloris a property, andredis the property valuetext-alignis a property, andcenteris the property value


Comments
Post a Comment