Jens Oliver Meiert

CSS and Specificity

Post from November 27, 2014 (↻ December 12, 2016), filed under .

This and many other posts are also available as a pretty, well-behaved e-book: 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 reasonable 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.)

More importantly, I wonder what we’ve missed in the community when it comes to setting some CSS fundamentals straight. Here are a few loose talking points, for I’m 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 that lead to Rome, even for us who prefer minimalist, tailored code. And there are always ways to offset 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 personally remember, and gladly so, was Anne.

About the Author

Jens Oliver Meiert, photo of July 27, 2015.

Jens Oliver Meiert is a developer (O’Reilly, W3C, ex-Google) and philosopher. He experiments with art and adventure. Here on meiert.com he shares and generalizes and exaggerates some of his thoughts and experiences.

There’s more Jens in the archives and at Amazon. If you have any questions or concerns (or recommendations) about what he writes, leave a comment or a message.

Read More

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

Or maybe say hi on Twitter, Google+, or LinkedIn?

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

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

You are here: HomeArchive2014 → CSS and Specificity

Last update: December 12, 2016.

“If there is any secret, it is missed by seeking.”