Why I No Longer Care About Valid HTMLWritten by Jeffrey Bennett
Notify the authorities and alert the press! What am I thinking?!
I know, it sounds crazy. Not perfectly conforming to the standards developed by the W3C for making pages on the web…
But there’s a method to this madness!
It used to be that web developers would wear the valid W3C image as a badge of honor, proudly displaying their accomplishments in the footer of the page.
It took a lot of sweat and tears to get that code perfectly valid. And damnit, you wanted to show it off!! I know. I used to do it myself!
You see, HTML was designed to be very flexible and forgiving with its syntax.
It had to be!
Nobody knew what they were doing back when it first came out. Even experienced developers would create code that the browsers needed to sweet talk back into decency.
This was a big reason for the strict standards created by the W3C.
Without these rules, chaos would ensue! Lions would run amuck. The dark ages would return. The fabric of the universe itself would rip to shreds!
For a long time, we knew that if a single tag wasn’t closed properly or nested tags were out of order, the whole page could fall apart.
Kind of like those old Christmas lights where one bulb goes out and the whole thing quits.
So we went out of our way to make sure our hard work showed up properly in the browsers of the time. Ahem, Internet Explorer. 😝
Because the browsers needed to follow the standards written by the W3C or risk shipping a useless piece of software, we knew that our W3C-approved valid HTML and CSS pages would work across the board.
And that was lovely! 😍
But then the web matured. Things got exponentially more complex.
The standards that once propelled the web forward began to fall behind the speed of innovation by the browsers themselves.
Soon, browsers had become extraordinarily powerful. They had to deal with astronomical amounts of code sent out by varying degrees of coding experience and creative expression.
The internet had fundamentally changed the entire world in ways we can never revert back to.
Suddenly, these browsers became the single most important application on a computer.
Things were changing much faster than anyone could have imagined. The internet itself had become self-sufficient and ever increasing in complexity.
And yet still, the W3C did a fantastic job of creating and maintaining the standards for the entire internet.
But even with all this power and knowledge, there are still humans behind the organization. The internet had simply outgrown its original purpose.
Browsers had to adapt faster than the standards were being created. Users expected more and developers needed ways to deliver more to their users.
It created a trifecta of power struggles.
Browsers, users, and developers, all needing more and more, while all being interdependent on each other.
Browsers created the features that developers asked for. Developers learned how to use these features and sent out their work to the users. Users enjoyed browsing.
Without users, developers would have nothing to show. Without developers, browsers would have no reason to ship updates. And without browsers, users would have nothing to see.
It’s like the circle of life.
It’s Too Much
It may sound like I’m jumping around here, but it all has to do with the reason I don’t seek out perfectly valid code anymore.
Browsers had to be more forgiving for code than ever before. Though many of these webpages were syntactically invalid, they still needed to “work” at the most basic levels.
They had to be more secure and stronger than necessary. And make assumptions for what incorrect code really meant to be.
And it all had to be crazy fast! That’s a lot to deal with for a single application.
There are sometimes pieces of code that offer tremendous value to a particular design or functionality on a page, that technically by the W3C standards, is invalid markup.
When filling out forms on a touch screen device, you have special attributes that affect the keyboard layouts and functions when typing.
Say you want to build a source code editor. Programming syntaxes are very specific and having automatic changes to the code text by autocorrect can create serious problems.
The simple addition of
autocorrect="off" takes care of this problem.
playsinline attribute to your
<video> tag to get them to play on iOS without going fullscreen. It’s actually required for autoplaying videos on iOS.
Another use for when users need to type an email address. When was the last time you needed to capitalize your email address (the default behavior of touch screen inputs)?
Hint: they are not case-sensitive. USER@DOMAIN.COM is identical to email@example.com
But it’s sometimes confusing for users, not to mention harder to read, when the the first letter is capitalized in an email address.
It all boils down to this:
“It’s not worth my time.”
Sure, test your code in every browser you can get your hands on, and twice in the ones your users use.
But spending the time necessary to really craft perfectly-valid syntax when “very good code” will do 98% of the time, is just not my best use of time as a developer.
There! I said it. I look forward to your angry letters. 😜