Abstract form

Don’t put comments at the first line of a HTML document

Posted in Company, Internet by Homam Hosseini on June 27, 2009

Here’s a funny problem we faced:

When Lionel, a graphic designer in the company, added new graphics to a page of the website he noticed that there’s something terribly wrong in IE. All the contents of the page had been aligned left, and the layout has been disturbed. The diagnostic process was straightforward, because all the other pages were working properly before, we started removing the contents of this new page, to find what exactly caused the problem.

After the page’s been nearly totally robbed, and we didn’t find a clue, we noticed the only difference between it and other pages was that this page had a comment line automatically being generated at the first line. So that’s it, don’t put any comment before the declaration in HTML.

This is what happens when you have a comment in the first line

This is what happens when you have a comment in the first line

Advertisements