Skip to Content
CSSCSS Basics

CSS Basics

What is CSS?

CSS (Cascading Style Sheets) controls the visual presentation of HTML elements.

Key Concepts

Selectors

/* Element selector */ body { margin: 0; } /* Class selector */ .container { max-width: 1200px; } /* ID selector */ #logo { width: 272px; }

The Box Model

Every element is a box with:

  • Content — the actual text/image
  • Padding — space inside the border
  • Border — the edge of the box
  • Margin — space outside the border

My Notes

Last updated on