Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 31.HTML5 为什么只需要写 <!DOCTYPE HTML> #52

Open
qiilee opened this issue Sep 29, 2019 · 0 comments
Open

[html] 31.HTML5 为什么只需要写 <!DOCTYPE HTML> #52

qiilee opened this issue Sep 29, 2019 · 0 comments
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Sep 29, 2019

答案:HTML 4.01 中的 doctype 需要对 DTD 进行引用,因为 HTML 4.01 基于 SGML。而 HTML 5 不基于 SGML,因此不需要对 DTD 进行引用,但是需要 doctype 来规范浏览器的行为。其中,SGML 是标准通用标记语言,简单的说,就是比 HTML,XML 更老的标准,这两者都是由 SGML 发展而来的。BUT,HTML5 不是的。

<!DOCTYPE>声明位于位于 HTML 文档中的第一行,处于 <html> 标签之前。作用:告知浏览器的解析器用什么文档标准解析这个文档。DOCTYPE 不存在或格式不正确会导致文档以怪异模式呈现。

@qiilee qiilee added the HTML label Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant