Coding/Learn/css/introduction
CSS Beginner Course
01.Introduction to CSS
02.Selectors (Element, Class & ID)
03.3 Ways to Add CSS to HTML
04.Colors & Backgrounds (HEX, RGB, HSL)
05.Typography & Fonts (font-size, font-weight, line-height)
06.The Cascade & Specificity Wars
07.The Sacred CSS Box Model
08.Padding vs Margin & Shorthand Notation
09.Borders & Border Radius (Rounded Corners & Circles)
10.The Magic of box-sizing: border-box
11.Sizing & Units (px, rem, em, %, vh, vw)
12.The Display Property (block, inline, inline-block, none)
13.Flexbox Part 1: Container Powers (justify, align, gap)
14.Flexbox Part 2: Direction, Wrapping & Item Powers
15.Positioning (relative, absolute, fixed, sticky)
16.Z-Index & The 3D Stacking Context
17.Pseudo-Classes (:hover, :active, :focus, :first-child)
18.Smooth Transitions & Box Shadows
19.Responsive Design & Media Queries (@media)
20.Capstone: Crafting a Modern UI Profile Card
Course Certificate0%

Complete all lessons to earn

LearnIntroduction to CSS
1 / 20 0%
Lesson 01 of 20
4 mins read

Introduction to CSS

All TracksNext Lesson
In Plain English

CSS (Cascading Style Sheets) is the digital paint, interior design, and styling wardrobe of the web. Without CSS, every website in the world would look like a 1993 research paper with blue underlined links, black Times New Roman text, and zero personality.

The Mental Model

"Think of a car. HTML is the engine, chassis, and metal skeleton. CSS is the sleek matte finish paint, aerodynamic curves, tinted windows, and leather seats. JavaScript is the gas pedal and dashboard computer."

Deep Dive: How It Works

Invented by Håkon Wium Lie in 1994, CSS was created to separate content (HTML) from visual presentation (CSS).

CSS works by targeting HTML elements and applying rules: "Find all <h1> headers, make them white, and give them a font size of 32px."

A CSS rule consists of a Selector, followed by a declaration block wrapped in curly braces { property: value; }.

Syntax Blueprint

selector {
  property: value;
}

Target the HTML element and set key-value styling declarations ending with semicolons.

PointCore Rules to Remember

Point star
Separation of Concerns: HTML handles content structure; CSS handles aesthetics and layout.
Point star
The Semicolon Rule: Every single declaration must end with a semicolon (;) or your stylesheet breaks!
Point star
Instant Visual Impact: Changing 3 lines of CSS can transform an entire website's visual identity.

Common Beginner Traps & How to Fix Them

Mistake:Forgetting the semicolon at the end of a line

Why it happens: Writing color: red without a semicolon confuses the browser on the next property.

How to fix: Always terminate each property: value pair with a semicolon: color: red;.

Pro Tip: In CSS, whitespace and indentation don't affect execution, but clean 2-space indentation makes reading code effortless.

Live Interactive Example

Hit Run Code to see it live
Your First CSS Rule
CSS3
1
2
3
4
5
6
7
8
9
10
Live Browser Preview
Click "Preview / Apply" to view the rendered output.
How it works: The h1 selector centers the headline in sky blue, while p styles body paragraphs for readability.

Your Turn: Micro Challenge

No pressure! Edit the starter code below and test your solution with instant feedback.

Micro Exercise

Style a heading in blue

  • PointWrite a CSS rule targeting h1 that sets color to #38bdf8;
1
2
Browser Preview & Output
Click "Run & Check" to test your solution.

Finished reading and practicing?

Mark this lesson as completed to update your course progress.

All TracksNext Lesson
Overview100 SheetLearnCertificates