Leanpub Header

Skip to main content

Modern CSS: The Platform Grew Up

A working developer's guide to the features that replace hacks, preprocessors, and a surprising amount of JavaScript.

Modern CSS: The Platform Grew Up
This book is 100% completeLast updated on 2026-10-16

Stop writing the workarounds. Modern CSS shows the native features that replace them, with working code you can run.

Minimum price

$7.00

$9.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

Buying multiple copies for your team? See below for a discount!

PDF
EPUB
About

About

About the Book

Your stylesheets are full of workarounds for things CSS could not do. Modern CSS: The Platform Grew Up shows you which ones you can delete.Between 2022 and 2026, browsers shipped more CSS than in the previous decade. Container queries, :has(), cascade layers, nesting, perceptual color, subgrid, popovers and view transitions are now Baseline, so you can use them in production. Many teams have not caught up. They still reach for the same preprocessor, the same class toggles and the same scroll listeners.

This book is for working front-end developers who already know flexbox and grid. It skips the basics and focuses on the features that replace hacks and JavaScript. Each of the seventeen chapters starts with a problem you have probably solved the hard way, shows the modern solution with working code, and ends with what you need to ship it: browser support, fallbacks, and the dependencies or glue code you can remove.

Every example is a working page you can open and change, and the code is free to use under the MIT licence. Most screenshots are real renders from Chrome. The book marks the two that are not, and it says so when a feature is still experimental.

The book covers architecture (cascade layers, native nesting, @scope and typed custom properties), layout (container queries, subgrid, intrinsic ratios and grid), selectors and state (:has(), context-aware styling and scroll-state queries), visual design (OKLCH color, light-dark(), typography and shape), motion (entry and exit animations, scroll-driven animations and view transitions), native components (popovers, dialogs, anchor positioning and widgets without JavaScript), and production (a capstone component kit and a migration playbook for real codebases).

Three appendices cover a dependency diet, a browser support matrix and a cheat sheet.

The aim is less code: fewer dependencies, fewer event listeners, and stylesheets you can still understand next year.

What you will learn

  • Replace specificity wars with @layer, native nesting, :where() and @scope
  • Build components that respond to their container, not the viewport
  • Style state with :has() instead of toggling classes in JavaScript
  • Use OKLCH, color-mix() and relative colors to build token systems
  • Animate height: auto, scroll position and page transitions
  • Ship popovers, dialogs, menus and tooltips with anchor positioning and little or no JavaScript
  • Migrate an existing codebase and delete the dependencies you no longer need

Share this book

Categories

Team Discounts

Team Discounts

Get a team discount on this book!

  • Up to 3 members

    Minimum price
    $17.00
    Suggested price
    $22.00
  • Up to 5 members

    Minimum price
    $28.00
    Suggested price
    $36.00
  • Up to 10 members

    Minimum price
    $49.00
    Suggested price
    $63.00
  • Up to 15 members

    Minimum price
    $70.00
    Suggested price
    $90.00
  • Up to 25 members

    Minimum price
    $105
    Suggested price
    $135

Author

About the Author

Sandeep Kumar Patel

Sandeep Kumar Patel is a senior web developer with more than 17 years of experience building web applications in object-oriented JavaScript and JSON. In 2012 he founded tutorialsavvy, a programming blog that developers have been reading ever since.

He is GATE-2005 Information Technology (IT) qualified and holds a Master's degree from VIT University, Vellore.

Contents

Table of Contents

  • Prologue: The New Baseline
    • 0. The New Baseline
  • Part I: Architecture
    • 1. Taming the Cascade
    • 2. Smarter Custom Properties
  • Part II: Layout
    • 3. Component-Driven Responsive Design
    • 4. Grid, Finally Complete
  • Part III: Selectors & State
    • 5. :has() Changes Everything
    • 6. Context-Aware Styling
  • Part IV: Visual Design
    • 7. Color Systems That Scale
    • 8. Typography & Shape Polish
  • Part V: Motion
    • 9. Entry, Exit & height: auto
    • 10. Scroll-Driven Animations
    • 11. View Transitions
  • Part VI: Native Components
    • 12. Popovers & the Top Layer
    • 13. Anchor Positioning
    • 14. Widgets Without JavaScript
  • Part VII: In Production
    • 15. Capstone: A Modern Component Kit
    • 16. The Migration Playbook
  • Back matter
    • Appendix A: The Dependency Diet
    • Appendix B: Browser Support Matrix
    • Appendix C: Cheat Sheet
    • About the Author

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub