Frank
Frank

Reputation: 2230

Is it bad practice to put a comment before <!DOCTYPE HTML>?

I like to head all my files with a comment about the file, but I've heard it's bad practice to put anything before the declaration. Is it okay to put comments before this or should I leave the top of my html files for the DOCTYPE?

Upvotes: 1

Views: 645

Answers (1)

Quentin
Quentin

Reputation: 943615

Putting a comment before the Doctype will trigger quirks mode in some browsers. Since the entire purpose of the Doctype (as of HTML 5) is to avoid quirks mode, yes, this is bad practise.

Screenshot of validator

Upvotes: 1

Related Questions