20

CSS Preprocessors

CSS includes functions that make writing rulesets easier, but there are even more powerful tools that can streamline and optimize your CSS code.

These tools are called CSS preprocessors, and they operate at a level above CSS. That is, they take what you write and convert it to CSS. Preprocessors add features that otherwise wouldn’t exist in CSS, the ability to reuse rulesets easily without copying and pasting, and loops (a way to automatically write code based on a set of criteria). Let’s take a closer look.

How CSS Preprocessors Work

A CSS preprocessor is essentially a programming language that produces valid CSS. You write ...

Get HTML and CSS: Visual QuickStart Guide, 9th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.