Skip to content

CSS Motivation

Larry Reid edited this page May 12, 2017 · 2 revisions

Some people with a lot of experience with big CSS seem to be consolidating around an approach to writing CSS that makes it easier to understand and use. This page describes our interpretation of this "new" approach, and has links to other readings. For our specific guidelines and advice, see the guidelines and advice page.

One common aspect of the "new" approach is the idea that the HTML file contains the content (obviously) and the content is formatted by classes applied to the HTML elements. To change the formatting, you change the classes that are applied to the HTML, rather than changing the CSS. As Nicolas Gallagher says at the end of his article: "anyone can rearrange pre-built “lego blocks”; it turns out that no one can perform CSS-alchemy."

This approach is explicitly moving away from the idea of "semantic CSS": That classes (or IDs) identified the type of content, and the CSS was written to format the content depending on where it appeared. While this idea seemed attractive when first put forward, in experience it has led CSS that's difficult to understand, and therefore difficult to maintain.

The original articles are easy to read and explain much better than I can:

Home

[Collaborating on Projects](Using GitHub to Collaborate on We Enhance IT Projects)

Clone this wiki locally