Skip to content

CSS

In one line

CSS (Cascading Style Sheets) is the language used to style and lay out HTML content on a web page.

In simple words

CSS controls how HTML looks. While HTML provides the structure, CSS decides the colors, fonts, spacing, layout, and responsive behavior. A single CSS rule can change the appearance of every matching element across an entire site.

CSS works by selecting elements (using selectors) and applying declarations (property-value pairs) to them. For example, p { color: blue; } makes every paragraph's text blue. The "cascading" part means multiple rules can apply to the same element, and CSS has rules to decide which one wins.

Modern CSS is powerful: you can build complex layouts with Flexbox and Grid, animate elements, and adapt the design to different screen sizes with media queries. CSS is essential for making web pages look professional and feel usable.

Example

css
/* Select all <p> elements and style them */
p {
  color: #2563eb;
  font-size: 16px;
  line-height: 1.5;
}

/* Center a heading */
h1 {
  text-align: center;
}

This CSS makes all paragraphs blue with a 16px font, and centers all <h1> headings.

Related terms

Related Resources

Related Lessons

  • CSS

    Learn CSS selectors, properties, and layout

Related Practice

Related Projects

Related Tools

Learn the fundamentals

Deepen your understanding with structured lessons on this topic.

View lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary