1

If I put <!DOCTYPE> in my HTML document then my browser will use HTML 5.0 to parse the document. If I don't use <!DOCTYPE> then which version of HTML will be used to parse the document?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Saurabh Kumar
  • 403
  • 4
  • 8

4 Answers4

7

If you don't specify a DOCTYPE the browser may go into Quirk mode which behaves different in every browser.

Quirks Mode is a mode of operation of web browsers such as Internet Explorer (IE), Firefox, and Opera. Basically, Quirks Mode (also called Compatibility Mode) means that a relatively modern browser in­ten­tio­nal­ly simulates many bugs in older brows­ers, es­pe­cial­ly IE 4 and IE 5.

Also, it's good to know what would happen, but you should remember to use it every time, it's in the html standard and you may have unexpected results if you omit it.

Wikipedia's Quirks Mode article is interesting as well.

Mark E
  • 3,403
  • 2
  • 22
  • 36
0

The browser will fall back to quirks mode. See it discussed/answered here:

what-happens-if-i-dont-put-a-doctype-html-in-my-code-will-it-make-any-major

Community
  • 1
  • 1
0
<!DOCTYPE html> // Tells the browser that we are using HTML5.

If document type is not mentioned, browser will go to Quirks mode. Quirks mode depends upon the web browser version, If is older version then this will not support HTML5 tags (Example: header tag, footer tag, section tag,...)

0

The declaration is first thing in the HTML document before any tag is defined. It is not an HTML tag but it is in an indication about the version of HTML used.

If you don't define it at the start then might be the browser may go into Quirks or Strict Mode.

Satyajit
  • 152
  • 10