What is CSS?
CSS (Cascading Style Sheets) is used to style and layout web pages. It controls the color, font, spacing, and positioning of elements.
Basic CSS Syntax:
CSS is written in rules. Each rule has a selector and a declaration block:
Example:
Basic Concepts:
-
Selectors: Used to select HTML elements to apply styles. Example:
p { color: red; } -
Properties & Values: Properties are aspects like color, font-size, or margin, and values are the settings for those properties.
-
Box Model: Every HTML element is treated as a box. The box has content, padding, border, and margin.
Common Properties:
-
color: Text color.
-
font-family: Font style.
-
margin: Space outside the element.
-
padding: Space inside the element.
-
background-color: Background color of an element.

