EthicsComputerCourses
Join training +91 90532 10052

CSS1, CSS2 & CSS3 Differences

CSS · Lesson 3 of 240 Beginner 10 min read Updated

By the end of this lesson you will be able to explain what CSS1, CSS2 and CSS3 each added, why "CSS3" is really a family of separate modules, and why nobody will ever release "CSS4". You will also learn the two tools professionals use to decide whether a feature is safe to use today: CSS Snapshots and Baseline.

The previous lesson, History and Evolution of CSS, told the story with dates. This lesson focuses on the differences and on what they mean for the code you write.

Levels, not versions

Software usually has versions: version 2 replaces version 1. CSS works differently. The CSS Working Group says CSS has levels, and each level builds on the one before it. Nothing is thrown away, so a rule written for CSS1 in 1996 still works in a browser today.

Think of a school library. In the early years there was one thick "Science" textbook, and a new edition meant reprinting the whole book. Later the school switched to separate books for physics, chemistry and biology. Each subject can now get a new edition whenever it is ready. CSS1 and CSS2 were the single thick textbook. CSS3 is the shelf of separate subject books.

CSS1CSS2 / CSS 2.1"CSS3"
Became a W3C RecommendationDecember 1996May 1998 / June 2011Each module on its own date
ShapeOne documentOne documentDozens of separate modules
Main focusFonts, colours, text, the boxPositioning, media types, more selectorsLayout, effects, responsive design and much more

A W3C Recommendation is a finished, official web standard.

CSS1: the basics (1996)

CSS1 was small. It gave authors control over the things that <font> tags and HTML attributes had been doing badly:

  • fonts and text: font-family, font-size, font-weight, text-align, line-height;
  • colours and backgrounds: color, background-color, background-image;
  • the box: margin, padding, border, width;
  • simple selectors: element names, classes, IDs and descendant selectors.

Everything in this rule was already possible in CSS1:

CSS
.menu-title {
  font-family: Georgia, serif;
  color: #8b0000;
  background-color: #fff3d6;
  padding: 8px;
  border: 1px solid #c06014;
}

The working group now calls the CSS1 document obsolete. Its features live on, but they are defined by newer specifications.

CSS2 and CSS 2.1: positioning and more (1998, 2011)

CSS2 added the tools for placing boxes exactly and for styling more than just the screen:

  • positioning: position: relative, absolute and fixed, plus top, left and z-index;
  • media types: different styles for screen and print;
  • more selectors: the child selector >, the adjacent sibling selector + and attribute selectors such as [type="email"];
  • generated content: :before, :after and the content property, to add text or symbols from CSS.

CSS 2.1 is the corrected edition of CSS2. It fixed mistakes and removed features no browser built. Where CSS2 and CSS 2.1 disagree, CSS 2.1 is the definition that counts. When people say "CSS2" today, they nearly always mean CSS 2.1. A draft called CSS 2.2 was started in 2016 but never finished.

CSS3: modules with their own levels

After CSS 2.1, the working group stopped writing one giant specification. Instead, CSS is split into modules, each covering one area: Selectors, Color, Backgrounds and Borders, Media Queries, Flexbox, Grid, Transitions and many more. "CSS3" is just the popular name for this approach. The specifications themselves say "CSS Level 3" exists only to tell it apart from the old single documents.

Each module has its own level number, using two simple rules:

  • A module that updates something from CSS2 starts at Level 3. Example: Selectors Level 3 replaced the CSS2 selectors.
  • A module for something brand new starts at Level 1. Example: CSS Flexible Box Layout Module Level 1, and CSS Grid Layout Level 1.

When a module needs new features, it gets a new level, independently of the others. So today there are modules at many different levels at the same time:

ModuleSome levels that existWhat a newer level added (examples)
SelectorsLevel 3, Level 4:is(), :where(), :has()
CSS ColorLevel 3, Level 4, Level 5oklch() in Level 4, color-mix() in Level 5
Media QueriesLevel 3, Level 4range syntax such as (width >= 600px)
Grid LayoutLevel 1, Level 2subgrid in Level 2

Why there is no CSS4

Once the modules started moving separately, a single number for "CSS" stopped making sense. Selectors could be on Level 4 while another module is still finishing Level 3. The CSS Snapshot says it directly: there is no CSS Level 4. Modules can reach level 4 or higher, but CSS the language no longer has levels.

So if you see a course or job advert asking for "CSS4", it really means modern CSS features. Do not search for a CSS4 download, because none exists.

Old CSS and modern CSS side by side

Here one railway ticket is styled three times. The first card uses only CSS1 features. The second adds CSS2 positioning and generated content. The third uses CSS3 modules.

HTMLOpen in editor
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>CSS1, CSS2 and CSS3 cards</title>
  <style>
    body { font-family: Arial, sans-serif; padding: 1rem; }
    .ticket { margin-bottom: 16px; padding: 10px; width: 260px; }

    /* CSS1 features only */
    .css1 { color: #222; background-color: #fff3d6; border: 1px solid #c06014; }

    /* CSS2 adds positioning and generated content */
    .css2 { background-color: #e3f2fd; border: 1px solid #1565c0; position: relative; padding-top: 28px; }
    .css2 .badge { position: absolute; top: 6px; right: 6px; background-color: #1565c0; color: white; padding: 2px 6px; }
    .css2 .route:before { content: "Route: "; font-weight: bold; }

    /* CSS3 modules: radius, shadows, gradients, Flexbox */
    .css3 {
      border-radius: 12px;
      box-shadow: 0 4px 12px rgb(0 0 0 / 0.2);
      background: linear-gradient(135deg, #e8f5e9, #b2dfdb);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .css3 .badge { background: #00695c; color: white; padding: 2px 8px; border-radius: 999px; }
  </style>
</head>
<body>
  <div class="ticket css1">
    <p class="route">Jaipur to Delhi, 12985</p>
    <p>Fare: ₹745 <span class="badge">AC Chair</span></p>
  </div>
  <div class="ticket css2">
    <p class="route">Jaipur to Delhi, 12985</p>
    <p>Fare: ₹745 <span class="badge">AC Chair</span></p>
  </div>
  <div class="ticket css3">
    <p class="route">Jaipur to Delhi<br>Fare: ₹745</p>
    <span class="badge">AC Chair</span>
  </div>
</body>
</html>

What you should see:

  1. The first card is a plain box with a border and a coloured background. The badge is just inline text.
  2. The second card pins the badge to the top-right corner with position: absolute, and the word "Route:" appears without being in the HTML.
  3. The third card has rounded corners, a soft shadow and a gradient, and Flexbox places the badge on the right, centred vertically.

Notice that all three levels work together on one page. That is what "levels, not versions" means in practice. One small difference: CSS2 wrote pseudo-elements with one colon (:before), and Selectors Level 3 introduced two colons (::before) to tell them apart from pseudo-classes. Browsers accept both for the old ones, but write ::before in new code.

Is it ready? Snapshots and Baseline

With dozens of modules at different stages, how do you know what you can use? There are two answers: one from the people who write the specifications, and one about browsers.

CSS Snapshots

Every module goes through stages. It starts as a Working Draft, becomes a Candidate Recommendation when it is ready for browsers to implement and test, and may finally become a W3C Recommendation.

From time to time the CSS Working Group publishes a CSS Snapshot. It lists which modules are stable and together make up "CSS" at that moment. The latest at the time of writing is CSS Snapshot 2026, dated 22 June 2026. A snapshot is mainly useful for browser makers and people who build tools. It tells you how stable a specification is, not whether browsers support it.

Baseline

For everyday work, developers care about one thing: does this work in the browsers my users have? Baseline answers that. It is defined by the W3C WebDX Community Group and shown on MDN and web.dev.

Baseline checks a set of core browsers: Chrome, Edge, Firefox and Safari, on desktop and mobile.

StatusMeaning
Limited availabilityNot yet supported in all core browsers
Newly availableWorks in the latest versions of all core browsers
Widely availableHas been newly available for 30 months, so most users' browsers support it

A year label groups features by when they became newly available. For example, the :has() selector worked in all core browsers in December 2023, so it is part of Baseline 2023. Thirty months later, in 2026, it became widely available. This course names the Baseline status whenever it teaches a newer feature.

You can also check support from CSS itself with @supports, which you will study in @supports Feature Queries. Run this checklist in your browser:

HTMLOpen in editor
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Feature checklist</title>
  <style>
    body { font-family: system-ui, sans-serif; padding: 1rem; }
    li { padding: 6px 10px; margin-bottom: 6px; background: #ffd6d6; list-style: none; }
    li::after { content: " (not supported)"; }

    @supports (display: grid) {
      .grid { background: #d4f5d4; }
      .grid::after { content: " (supported)"; }
    }
    @supports selector(:has(a)) {
      .has { background: #d4f5d4; }
      .has::after { content: " (supported)"; }
    }
    @supports (container-type: inline-size) {
      .cq { background: #d4f5d4; }
      .cq::after { content: " (supported)"; }
    }
    @supports (color: oklch(70% 0.1 200)) {
      .oklch { background: #d4f5d4; }
      .oklch::after { content: " (supported)"; }
    }
  </style>
</head>
<body>
  <h2>Does Ananya's browser support these?</h2>
  <ul>
    <li class="grid">CSS Grid (all browsers since 2017)</li>
    <li class="has">:has() selector (Baseline 2023)</li>
    <li class="cq">Container queries (Baseline 2023)</li>
    <li class="oklch">oklch() colours (Baseline 2023)</li>
  </ul>
</body>
</html>

In any current browser, all four rows turn green. In a browser that is several years old, some rows stay red. This is the pattern professionals use: write a safe base style first, then add newer features inside @supports.

Common mistakes

  • Searching for "CSS4" or a "CSS3 download". CSS is not installed. Browsers support features one by one, and there is no CSS4.
  • Treating "CSS3" as a finished version. Many modules are still being written, and new levels keep arriving.
  • Assuming a Recommendation means browser support. Spec status and browser support are different questions. Check Baseline for support.
  • Writing :before in new code. It still works, but ::before is the modern way to write pseudo-elements.

Interview questions

1. What is the main difference between CSS2 and CSS3?

CSS2 (and its corrected edition, CSS 2.1) is one single specification. CSS3 is not one document but a set of separate modules, such as Selectors, Color and Flexbox, each with its own level and progress. CSS3 modules added features like rounded corners, gradients, media queries, Flexbox and Grid.

2. Is there a CSS4?

No. The CSS Working Group states that there is no CSS Level 4. Individual modules can reach Level 4 or higher, such as Selectors Level 4 or Color Level 4, but the language as a whole no longer has a level number.

3. Why do some modules start at Level 1 and others at Level 3?

Modules that update a feature from CSS2, such as selectors or backgrounds, start at Level 3 to continue the numbering. Modules for features CSS2 never had, such as Flexbox and Grid, start at Level 1.

4. What is Baseline?

Baseline is a label that tells you whether a web feature works in all core browsers: Chrome, Edge, Firefox and Safari. "Newly available" means the latest versions of all of them support it. "Widely available" means 30 months have passed since then.

5. What is a CSS Snapshot?

It is a document published by the CSS Working Group that lists the modules that are stable and together define CSS at that time. It describes specification maturity, not browser support, so developers usually check Baseline as well.

Key points

  • CSS has levels, not versions; each level builds on the last and old CSS still works.
  • CSS1 (1996) covered fonts, colours, text and the box; CSS2 (1998) added positioning, media types, more selectors and generated content.
  • CSS 2.1 (2011) is the corrected edition of CSS2 and the foundation of modern CSS.
  • "CSS3" means separate modules, each with its own level; there is no CSS4.
  • CSS Snapshots show which specifications are stable; Baseline shows what works in browsers.
  • Use @supports to add newer features on top of a safe base.

Exercise

Kabir runs a small bookshop website in Kochi. Make a page with three book cards: style the first using only CSS1 features, the second adding CSS2 features (position a "New" badge in a corner and add a label with ::before), and the third with CSS3 features (rounded corners, a shadow and Flexbox). Then add a fourth card that uses display: grid only inside an @supports (display: grid) block, with a plain fallback outside it. Add a comment above each card's rules naming the level.

Show solution
HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Kochi Books</title>
  <style>
    body { font-family: Arial, sans-serif; padding: 1rem; }
    .book { width: 280px; padding: 10px; margin-bottom: 16px; }
    /* CSS1 */
    .one { background-color: #fff8e1; border: 1px solid #a1887f; }
    /* CSS2 */
    .two { background-color: #e3f2fd; border: 1px solid #1565c0; position: relative; }
    .two .new { position: absolute; top: 6px; right: 6px; background-color: #1565c0; color: white; padding: 2px 6px; }
    .two .price::before { content: "Price: "; font-weight: bold; }
    /* CSS3 */
    .three { border-radius: 10px; box-shadow: 0 3px 10px rgb(0 0 0 / 0.2); display: flex; justify-content: space-between; }
    /* Fallback first, Grid only where supported */
    .four { border: 1px solid #999; }
    @supports (display: grid) {
      .four { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
    }
  </style>
</head>
<body>
  <div class="book one"><p>Malgudi Days</p><p class="price">₹250</p></div>
  <div class="book two"><span class="new">New</span><p>Malgudi Days</p><p class="price">₹250</p></div>
  <div class="book three"><p>Malgudi Days</p><p class="price">₹250</p></div>
  <div class="book four"><p>Malgudi Days</p><p class="price">₹250</p></div>
</body>
</html>

The four cards show the levels stacking on one page. The last card gets a plain bordered box everywhere, and a two-column grid only in browsers that pass the @supports test.

Quick Quiz

1. Which statement about CSS4 is correct?

2. Which feature first arrived with CSS2?

3. Why does CSS Flexible Box Layout start at Level 1?

4. What does Baseline "Widely available" mean?

Learn CSS with a mentor

Free lessons get you started. Our Full Stack Web Development training adds real projects and code reviews from working developers.

  • Project-based learning
  • Mentor code reviews
  • Free counselling call