Jens Oliver Meiert

HTML Statistics: 5 Take-Aways

Post from February 13, 2017 (↻ May 31, 2019), filed under .

A few quick comments on Catalin Rosu’s interesting follow-up analysis of his sampling of eight million websites. Some practices, those that can be considered commendable, are wonderful to note, others Catalin and Chris have already justly commented on, yet one or the other point drowned. I find this a great opportunity to review.

  1. Hiding DOM elements: Instead of using presentational class names we should, as always, use functional or generic names.

  2. no-js HTML class: no-js is an anti-pattern because on the one hand, the class reflects dynamic state (behavior) in a permanent fashion (structure), and on the other, links a general problem (scripting fallbacks) to a specific solution (JavaScript), and so we should avoid it (or use a different name—at Google, some teams had decided for “google”, a name that can be justified on the root element while affording the needed hook).

  3. lang: There are problems with lang, from the possibility to set language on a server level to making the issue of language detection a software problem, and in many cases we don’t need it.

  4. .clearfix vs .clear vs .cf: Naming best practices don’t yield to popularity. We should clear containers with what we have in the markup, and if there are no hooks, then we should use functional or generic names again. As for clearfixes in general, let’s just use overflow.

  5. Void elements: A bit snarky, are the people who suggest not to close void elements “for brevity” the ones who are still afraid of omitting optional tags? The recommendation is spot on, and there’s good reason to go as far as to omit everything that’s optional, for the same brevity—especially when brevity not only aids performance but also understanding.

❧ One or the other point may seem strict but what they all reflect is the idea of tailoring, of only using what’s necessary and avoiding everything that’s unnecessary and, of course,—the idea of quality.

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 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,

You are here: HomeArchive2017 → HTML Statistics: 5 Take-Aways

Last update: May 31, 2019

“Work is love made visible.”