FREE COURSE | BEGINNER

CSS Fundamentals

Learn how to transform simple webpages into beautiful, responsive websites.

01. Introduction to CSS

CSS stands for Cascading Style Sheets. It controls the appearance and layout of webpages.

What can CSS do?

  • Change colors and fonts.
  • Design webpage layouts.
  • Add spacing and borders.
  • Create responsive websites.

02. CSS Syntax

A CSS rule consists of a selector and a declaration block.

Editable source code
Live output

Understanding the code

  • h1 - Selector
  • color - Property
  • teal - Value
  • color: teal; - Declaration

03. CSS Selectors

Selectors identify the HTML elements that we want to style.

Element Selector

Editable source code
Live output

Class Selector

Editable source code
Live output

ID Selector

Editable source code
Live output

04. Colors and Backgrounds

CSS allows us to customize text colors and background colors.

Editable source code
Live output

Colors can be defined using color names, hexadecimal values, RGB, and HSL.

05. CSS Box Model

Every HTML element is represented by a rectangular box.

  • Content - Text or images.
  • Padding - Space around the content.
  • Border - Surrounds the padding.
  • Margin - Space outside the border.
Editable source code
Live output

06. Try It Yourself

Modify the CSS properties below and click Run CSS to see the changes.

Editable source code
Live output

07. Knowledge Check

Test your understanding of CSS fundamentals.

1. What does CSS stand for?

2. Which property changes the text color?

3. Which symbol identifies a class selector?

4. Which property adds space between the content and border?

5. Which property creates rounded corners?

Back to Courses