CSS

The styling language of the web, controlling layout, colors, typography, and animations.

Declarative
Beginner
1996
Håkon Wium Lie, Bert Bos

Overview

CSS (Cascading Style Sheets) describes the presentation of HTML documents. Modern CSS supports grid and flexbox layouts, custom properties, container queries, nesting, and complex animations.

Key Features

  • Flexbox & Grid — Powerful layout systems
  • Custom Properties — CSS variables for dynamic theming
  • Container Queries — Component-level responsive design
  • Animations & Transitions — Hardware-accelerated motion
  • Nesting — Native CSS nesting

Code Example

css
:root {
  --primary: hsl(180, 100%, 30%);
  --bg: hsl(220, 20%, 4%);
  --radius: 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;

  .card {
    background: var(--bg);
    border-radius: var(--radius);
    transition: transform 0.3s ease;

    &:hover {
      transform: translateY(-4px);
    }
  }
}

Learning Resources

Learning Path

12 topics across 3 sections

1Basics

  • Selectors — Element, class, ID, attribute, pseudo-class, and combinators
  • Box Model — Content, padding, border, margin, and box-sizing
  • Colors & Typography — Color formats, fonts, line-height, letter-spacing
  • Units — px, em, rem, %, vh/vw, and when to use each

2Layout

  • Flexbox — Flex container, items, alignment, wrapping, and ordering
  • Grid — Grid template, areas, auto-fill, minmax, and subgrid
  • Positioning — static, relative, absolute, fixed, sticky
  • Responsive Design — Media queries, container queries, and mobile-first approach

3Modern CSS