w3c - Which has to be first on a HTML document Doctype or Comment? -


in proper html document, 1 should written first. either doctype or comment.

like

<!--     copyright (c) 2014 , pvt ltd.     @file index.html --> <!doctype html> 

or

    <!doctype html>     <!--         copyright (c) 2014 , pvt ltd.         @file index.html     --> 

8.1 writing html documents

documents must consist of following parts, in given order:

  1. optionally, single "bom" (u+feff) character.
  2. any number of comments , space characters.
  3. a doctype.
  4. [...]

so shouldn't matter if write first doctype , comment, or viceversa.

however, html validator warns if use comment before doctype, ie go quirks mode. better use doctype first.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -