2014-10-27 108 views
4

Web瀏覽器如何區分HTML5和HTML4?Web瀏覽器如何區分HTML5和HTML4?

+1

的可能重複[什麼是HTML 4和HTML 5之間的關鍵區別?(http://stackoverflow.com/questions/134727/whats-the-key-difference- between-html-4-and-html-5) – dokaspar 2014-10-27 22:06:10

+1

請參閱[不要忘記添加文檔類型](http://www.w3.org/QA/Tips/Doctype) – Boaz 2014-10-27 22:06:19

+0

所以答案是:DTD聲明? – 2014-10-27 22:07:30

回答

3

根據w3schools,以下DOCTYPE定義文檔作爲HTML5:

<!DOCTYPE html> 

而且三種類型HTML4的由下列DOCTYPE聲明定義:

HTML 4.01嚴格

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 

HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 

HTML 4.01框架集

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">