CSS Fundamentals
Learn CSS from scratch with 31 hands-on exercises and a live preview editor. Selectors, colors and units, the box model, typography, display and positioning, flexbox, backgrounds and borders, transitions, all runnable in your browser with instant visual feedback.
01. Selectors & Syntax
How a CSS rule is built and how to target elements.
The anatomy of a CSS rule
Every CSS rule has a selector and a declaration block. Inside the block you write property: value; pairs.
selector {
property: value;
}
The core selectors
- Type:
ptargets every paragraph. - Class:
.badgetargets elements withclass="badge". Reusable. - ID:
#titletargets the single element withid="title". Unique. - Grouping:
h1, h2applies the same rule to several selectors. - Descendant:
nav atargets links inside a nav.
Specificity in one line
When rules conflict, an ID beats a class, and a class beats a type selector. Keep selectors as simple as the job allows.
Exercises (4)
Type selector
Select every <p> element and set its color to red.
Frequently Asked Questions
Do I need prior CSS experience to take this course?
No. The course starts from the anatomy of a CSS rule and builds up step by step to flexbox layouts and hover transitions. A basic understanding of HTML structure is helpful but not strictly required.
Can I run the exercises without installing anything?
Yes. Every exercise uses a dedicated CSS playground with a live HTML preview. You write CSS and see the result update instantly in the browser. There is nothing to install.
How long does the course take?
About 6 hours at a comfortable pace across 8 lessons and 31 exercises of increasing difficulty. You can work at your own speed and revisit any exercise at any time.
Is this course really free?
Yes, completely free, with no sign-up, no paywall, no ads and no tracking. CodeHelper is an open educational resource supported by the community.
Related
Free forever, no ads, no tracking. Support the project