Introduction
Syntax

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.

Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces.

Selectors

A CSS selector selects the HTML element(s) you want to style.

CSS selectors are used to "find" (or select) the HTML elements you want to style.

We can divide CSS selectors into five categories:Simple selectors (select elements based on name, id, class), Combinator selectors (select elements based on a specific relationship between them), Pseudo-class selectors (select elements based on a certain state), Pseudo-elements selectors (select and style a part of an element), Attribute selectors (select elements based on an attribute or attribute value),

CSS element selector
p { text-align: center; color: red; }
CSS ID selector
#para1 { text-align: center; color: red; }
CSS class selector
.center { text-align: center; color: red; }
HTML elements can refer more than 1 class

This paragraph refers to two classes.

CSS Universal selector
* { text-align: center; color: blue; }
The CSS Grouping Selector
h1 { text-align: center; color: red; } h2 { text-align: center; color: red; } p { text-align: center; color: red; }
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.

Borders

The CSS border properties allow you to specify the style, width, and color of an element's border. The border-style property specifies what kind of border to display

we can have many types of borders including border-width, Border-Color, Border-sides, Border-Shorthand, Rounded Borders

Margin

The CSS margin properties are used to create space around elements, outside of any defined borders. With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).