CSS Syntax || Bcis Notes

CSS Syntax

A CSS comprises style rules that are interpreted by the browser and then applied to the corresponding elements in a document. A style rule set consists of a selector and declaration block.

Selector => h1
Declaration => {color:blue;font size:12px;}

-The selector points to the HTML element you want to style.
-The declaration block contains one or more declarations separated by semicolons.
-Each declaration includes a CSS property name and a value, separated by a colon.
For Example:
-> color is property and blue is value.
-> font size is property and 12px is value.

A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.

 

CODE:

 

Result:

CSS Comments
Comments are used to explain the code and may help when you edit the source code at a later date. Comments are ignored by browsers.

CODE:

 

Result:

 

You may also like : CSS Introduction

Leave a Comment

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