How To Please The Vile W3C HTML Validator

Standards are everything in the tech world. They control MP3s, AACs, MPEGs, Javascript, XML, and nearly every other popular format in existence (well… except for those Microsoft formats…) HTML is no different - and while it isn’t uncommon to see different browsers (or even the same browser on different platforms) disagree with each other, coding your website or blog according to the W3C standards is by far the best way of guaranteeing compatibility on the various browsers, OSes, devices, etc.

For the most part staying compliant is a skill that you can learn very quickly (literally in days), but there are little things here and there that may destroy your web page on certain browsers, and usually these bugs are something simple. Fortunately for us the W3C (the guys who handle the HTML and XHTML standards) provides a fairly nice tool for testing the validity of your code.

Usually the HTML validator provides some nice advice on how to fix your code, but occasionally you may encounter an error or warning that makes no sense at all. This post is about the more common confusing errors and warnings:

Mismatched Tags… Uhhh What Mismatched Tags?

There are several obvious things that may caused the “mismatched tags” error - and usually it is something simple like forgetting to close off a paragraph or DIV. However, having mismatched lower/upper case elements can also cause the mismatched tags error - h1 is not equal to H1 in the eyes of the validator.

End Tag For UL Which Is Not Finished

Having empty lists (or mismatched tags - see above) causes this error. All lists must have at least one list item, but the list item doesn’t have to have anything in it.

Missing Alt Attribute

Alt attributes are added to images to help assist users who cannot get an image to load, who use text-based browsers, and who use accessibility software. Alt tags are also used by most search engines. They take 5 seconds to add and can greatly help your visitors. “A photo of outside” is a bad alt attribute - “new york skyline at dusk” is a much better attribute.

Character Encoding Mismatch!

This warning occurs when your web server sends a html document as one type, but the document itself says it is in a different encoding. This is one warning that Nusuni Dot Com gets - I suppose I should fix it. My server (Apache) says the files are UTF-8, but my meta tag uses the common iso-8859-1 encoding. As far as I know not having them match probably isn’t going to kill your page - but it is an annoying warning nonetheless.

Entity Was Defined Here

Whenever you put something like a URL onto your page, entities like & must be escaped correctly. For example:

http://www.example.com/test?test=bla&heh=1

Should be written as:

http://www.example.com/test?test=bla&heh=1

Document Type Does Not Allow Element Here / Character Data Is Not Allowed Here

These two errors are usually caused by the same issue - forgetting to put characters into block elements. Basically, it is against the XHTML standards to put inline elements (like links, spans, etc) and plain text directly in the body tag. Inline elements must be inside some sort of block element, like P, DIV, H1-H6, PRE, etc.

That is just a few of the many errors and warning your may see - if you encounter one that you simply cannot figure out leave a comment so we can try to help you out.

Cool Links - 10-31-07

How To Make $1m A Week From Facebook

“I Buy Souls”

Heh. :twisted:

Zombies In Plain English

Watch out for the zombies tonight. OK?

Should ISPs Forward E-mails?

WebProNews asks the question, should ISPs forward all e-mails if your account gets closed? With phone numbers and snail-mail that can happen - but no regulation forces ISPs do to the same with e-mail. Forcing it would further increase the government’s hold on corporations - a big no no in a capitalistic society.

Tyler Cruz Has A New Look!

I’d have to say… I think Tyler Cruz’s new layout is better than any of the other major redesigns.

Looking For Positives In Negatives

Couldn’t agree more. Pessimism gets you nowhere.

Cool Links - 10-25-07

Amazon Patents Search URL

Yet another reason why I completely despise patents, especially software and design patents. Why the heck is a “search string” worthy of a patent?

How To Separate WordPress Comments And Trackbacks

This is something I’ve been thinking about doing here.

The Ten Commandments of Blog Typography

No strange fonts, no funky colors, and no squished letters. It’s as simple as that.

Darren Rowse and Yaro Starak Talk Blog Design

Darren and Yaro discuss blog design - both of their blogs have had major redesigns in the past few months.

Create A Slogan For The PageRank Slam!

Darren Rowse and Brian Clark are running a little contest. Pick the best slogan for the PageRank slam and get free 3 month subscription to Brian’s new Teaching Sells program. Mine is “PR? They’re Still Using That Thing?” :mrgreen:

California May Force Website Owners To Make Sites Visually Impaired-Friendly

Disabled AccessTarget was well… the target of a recent lawsuit about whether or not they should be forced to make their site visually impaired-friendly. The Judge said yes, so now Target may be attacked by a class action suit because apparently not letting disabled users use your site somehow causes hundreds of thousands of dollars worth of damage. This ruling could possibly become a national thing too, because of the Americans With Disabilities Act.

What’s next? Are they going to sue companies that make roller coasters because it is difficult for someone without legs to use them? Am I going to get sued because some tool on this site doesn’t work well with accessibility software? Are car manufacturers going to get sued because a blind person can’t drive their vehicles?

Actually here is a good point: Google owns YouTube. Google is in California. What will this ruling mean for them? I say give it a few months before someone sues them for not providing transcripts for the videos on there. You know, not being able to access YouTube and view videos of guys getting hit in the crotch with golf clubs really causes emotional duress and causes millions of dollars worth of damage. :roll:

Like I said, give it a few months. Someone will sue Google over that.

And just so you guys don’t think I am an anti-disabled user, I’m not. I think everyone should be able to use the Internet, however, with current technology this would definitely put an undue burden on website owners if they run sites with lots of javascript, flash media, videos, etc.

Maybe I’m just overreacting and this isn’t a big deal - but the fact Judges have been forcing companies to do more and more scares the crap out of me. Especially if the rulings are vague like this one.

Gzip Compression Now Enabled

I just enabled Gzip compression via a WP-Cache hack. Gzip compression will decrease the amount of data the server needs to send each time someone visits. The homepage here before was around 29 kilobytes, now it is less than 10. I’d call that a nice decrease. So this blog should be quite a bit snappier now :)

You can enable Gzip compression if you don’t use WP-Cache by using the option in the “Reading” options page.

If you do use WP-Cache (you should use it!), just add this line: “if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’);” immediately above the “foreach ($meta->headers as $header) {” line in the wp-cache-phase1.php file.

I found this hack on chrisstormer.com

And yes, Gzip compression even works on good ol’ lame Internet Explorer.

One thing you should know is this only compresses the HTML your blog sends to each user who views your page, it doesn’t do images, CSS files, etc.