<分区>
在文档类型声明之前有空行回车是否有效?
The
<!DOCTYPE>
declaration must be the very first thing in your HTML document, before the<html>
tag.
<分区>
在文档类型声明之前有空行回车是否有效?
The
<!DOCTYPE>
declaration must be the very first thing in your HTML document, before the<html>
tag.
最佳答案
不一定; BOM、空格和注释可能先出现。
http://www.w3.org/TR/html-markup/documents.html#syntax-document-html
是的,它必须排在第一位,在任何实际的 HTML 标记之前,但请注意,您不能真的将 doctype 放在 BOM 之前。
关于HTML Doctype 是第一件事吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15205063/