- Basics
- Selectors
- Colors
- Units
- Inheritance, Specificity & Cascade
- !important and when to avoid it
- Box Model and Layout
- Display Property
- Position Property
- Flexbox
- Grid Layout
- Centering (vertical & horizontal)
- Z-index and Stacking Context
- Typography
- Visual Effects
- Responsive Design
- Animations
- Advanced CSS
- Best Practices and Accessibility
Basics
Learn what CSS is, how it styles HTML, and understand its basic syntax with simple examples.
Loading...
- CSS stands for Cascading Style Sheets.
- It is used to style HTML elements (like changing colors, fonts, layouts).
- Without CSS, websites would look plain and boring.
- CSS makes websites beautiful, organized, and user-friendly.
For example:
HTML adds text:
<h1>Hello</h1>
CSS changes how it looks:
h1 {
color: blue;
font-size: 30px;
}
Syntax and Structure
CSS has a simple pattern:
selector {
property: value;
}
- Selector: Picks the HTML element(s) you want to style.
- Property: The style aspect you want to change, like color, font size, margin, etc.
- Value: The specific setting you want for that property, like red for color or 16px for font size.
Example:
p {
color: red;
}
p
is the selector, meaning it targets all<p>
(paragraph) elements in the HTML.color
is the property, which controls the text color.red
is the value, so all paragraph texts will be colored red.