Jens Oliver Meiert

CSS and Specificity

Post from November 27, 2014 (↻ October 23, 2020), filed under .

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

Specificity is one of CSS’ greatest features, though an area that is as challenging as it is important to manage on projects of any decent size. Specificity is something a web developer needs to master, and that includes knowing when to use IDs, when (and why) to nest selectors, and also when to use !important.

With that I gently nudge Harry to reconsider some of the premises in his post on the specificity graph and, if possible, to build a stronger case. (Yet I do think Harry’s on to something very promising with the graph itself. We should follow his work there.)

Specificity visualized.

Figure: A specificity graph. (Courtesy Harry Roberts.)

In general, however, I wonder what we’ve missed in the community when it comes to getting CSS fundamentals right. Here are a few loose talking points, for I am was slowly retreating once my next two web development books—more soon!—are out:

Yet at the end of the day, there’s no set formula. There are “several roads leading to Rome,” even for us who prefer minimal, tailored code. And there are always ways to mitigate issues, as with proper documentation.

My cordial greetings to Harry, who I’ve on more than one occasion tried to hire at Google. I’d still love to see him there, and see him thrive (though he’ll do that anywhere). Harry is one of a few young rockstars whose rise you can follow now; the first I’ve felt similar about was Anne.

About Me

Jens Oliver Meiert, on April 29, 2020.

I’m Jens Oliver Meiert, and I’m a web developer and author. I love trying things (sometimes involving philosophy, art, or adventure). Here on meiert.com I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment or a message.

Read More

Have a look at the most popular posts, possibly including:

Cover: CSS Optimization Basics.

Perhaps my most relevant book: CSS Optimization Basics (2018). Writing CSS is a craft. As craftspeople we strive to write high quality CSS. In CSS Optimization Basics I lay out some of the most important aspects of such CSS. (Also available in a bundle with Upgrade Your HTML and The Web Development Glossary.)

Stay up-to-date? Follow me by feed or on Twitter.

Looking for a way to comment? Comments have been disabled, unfortunately.

Found a mistake? Email me, jens@meiert.com.

You are here: HomeArchive2014 → CSS and Specificity

Last update: October 23, 2020

“Work is love made visible.”