Jens Oliver Meiert

98% of the Top 100 U.S. Websites Use Invalid HTML (in 2021)

Post from May 18, 2021 (↻ July 28, 2021), filed under .

Is frontend development in the bad shape it’s said to be? Is it hyperbole when frontend developers are accused of poor quality work? Or is there merit to the idea that craft and profession are lacking?

With the discipline being attacked for good and bad reason, I wanted to take a quick sample of where we stand. For that reason I grabbed the 100 most popular U.S. websites, per Ahrefs, and validated the HTML and CSS of all the respective homepages. [I missed the global list! 44 of the Top 100 U.S. sites are also in the global Top 100, but I might post an update.]

Why validate? If you’re a frontend developer who’s asking that, then you’re currently part of our craft’s and our profession’s problem. As frontend developers we validate our HTML and CSS to produce output in conformance with the underlying standards, to preempt a variety of issues, to avoid unnecessary code, and in recognition that valid output differentiates us from non-professionals, because everyone can produce invalid code.

The result is sobering.

Of 100 websites, only 2 have 0 HTML errors. 2.

That is, of course, of 100 websites, 98 have HTML errors.

Of 100 websites, 34 websites even have more than 100 HTML errors. (Errors, not warnings.)

The average number of HTML errors is 125.22.

How is this for CSS?

Of 88 websites (that the CSS validator could test), only 3 have no CSS errors (3.4%).

Conversely, of those 88 websites, 85 have CSS errors (96.6%).

Of 88 websites, more than 11 websites have more than 100 CSS errors.

The average number of CSS errors is 48.4.

(Check the spreadsheet for details as well as explanations.)

The first 18 validation results.

Figure: The only website with both valid HTML and CSS code? The CDC’s. (Maybe not surprising.)

This is, and I’ve stopped to mince words, pathetic. True, we probably use shitty tooling. That’s one thing we need to change (and to put pressure on, if that tooling is not under frontend developer control). But these numbers also reflect poor craft and an unprofessional attitude.

If you’re a frontend developer, the first sign you’re a professional is that you ship valid code. (Any random person on the street can ship invalid code. Your houseplant can write invalid code when you put it on a keyboard.)

If you run a website, it’s also only professionally done if it’s valid. (If you work with third parties like agencies and freelancers, add valid output to your contracts.)

Validation is fundamental stuff. It’s simple. It’s useful. It’s important. We need to get this right—and our act together as frontend developers.

Tweet this? (If it changed your life, you delight me with a coffee.)

About Me

Jens Oliver Meiert, on April 29, 2020.

I’m Jens Oliver Meiert, and I’m an engineering manager and author. I’ve worked as a technical lead for Google, I’m close to the W3C and the WHATWG, and I write and review books for O’Reilly. Other than that, I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.

If you have questions or suggestions about what I write, please leave a comment (if available) or a message.

Read More

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

Cover: The Web Development Glossary.

Perhaps my most comprehensive book: The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.

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: HomeArchive2021 → 98% of the Top 100 U.S. Websites Use Invalid HTML (in 2021)

Last update: July 28, 2021

Professional frontend developers produce valid HTML and CSS.