Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which mode is IE6 if doctype is html as HTML5?

If web page has doctype as HTML5.

<!doctype html>

Which render mode is it for IE6?

The document.compatMode tells CSS1Compat. It looks Standard mode, not quirks mode. But, is it true? IE6 is released before HTML5 term is coined. How can IE6 recognize HTML5 doctype?

like image 953
Morgan Cheng Avatar asked May 09 '11 09:05

Morgan Cheng


People also ask

Which DOCTYPE is correct for HTML5 in HTML?

Correct Option: Ddoctype html>, doctype is the very first thing to write in HTML5.

Which mode is enabled when we put DOCTYPE directive at the top of an HTML file?

DOCTYPE html> is to activate full standards mode. Older versions of HTML standard DOCTYPEs provided additional meaning, but no browser ever used the DOCTYPE for anything other than switching between quirks mode and standards mode. See also a detailed description of when different browsers choose various modes.

What is Quick mode in HTML?

Quirks mode means your page is running without a document type declared, the document type is defined at the very top of a page and it denotes how the browser should read the HTML.

Will HTML5 work without DOCTYPE HTML?

It is not valid to omit the DOCTYPE. There is no “Standard” format. The browser will just try to parse HTML as best it can. But not all elements will be displayed correctly.


1 Answers

The HTML5 doctype was specifically chosen because it was the shortest doctype string possible that triggered standards mode in all browsers (starting with IE6). This was a deliberate decision based on what what would work in browsers that were already in use.

In other words, if you specify <!doctype html>, IE6 should go into standards mode, not quirks mode.

The reason it works is because IE6 (and others) are actually quite lenient on the doctype; they're making the assumption that if there's a doctype there, the developer probably intended to be in standards mode. If they don't recognise it, they're assuming that either the developer made a typo or there's been a new doctype invented that wasn't around when the browser was released; either way, the browser attempts to make the best of it and work in standards mode. The HTML5 team discovered that html was the shortest doctype string possible which triggered this behaviour, hence its use as the HTML5 doctype.

What the HTML5 doctype doesn't do of course is trigger old browsers like IE6 to actually support any of the new HTML5 features. This is obvious really. Products like Modernizr and HTML5Shiv can help with that, but only up to a point.

like image 107
Spudley Avatar answered Sep 29 '22 14:09

Spudley