的缺点是什么?

时间:2022-06-01 17:51:15

Are there any disadvantages if i replace doctype

如果我替换doctype有任何缺点

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

to

<!DOCTYPE HTML>.

3 个解决方案

#1


<!DOCTYPE HTML> is a HTML 5 doctype declaration,

是HTML 5 doctype声明,

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

而是一个HTML 4.01 Transitional声明。

This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed.

此DTD包含所有HTML元素和属性,包括表示元素和不推荐使用的元素(如字体)。不允许使用框架集。

So if you are using any deprecated elements from HTML 4.01, they won't work anymore when you switch to <!DOCTYPE HTML>. But if you're just keeping yourself to HTML 5 standards, you're fine. Normally you won't have this issue.

因此,如果您使用HTML 4.01中任何已弃用的元素,当您切换到时,它们将不再起作用。但是,如果您只是保持自己的HTML 5标准,那么你很好。通常你不会有这个问题。

#2


According to WHATWG <!DOCTYPE html> is recommended because it triggers standard mode in all browsers, including legacy ones. The other doctype you mentioned has simply no use anymore.

根据WHATWG推荐,因为它会在所有浏览器中触发标准模式,包括传统浏览器。你提到的另一个doctype根本就没用了。

#3


A "Document Type Declaration" is an SGML concept for signalling the mark-up syntax and vocabulary for the mark-up that follows. <!DOCTYPE html> does not conform to the requirements of that.

“文档类型声明”是SGML概念,用于发信号通知后面标记的标记语法和词汇表。 不符合要求。

This is unlike <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which is a SGML conforming Document Type Declaration.

这与不同,这是符合SGML标准的文档类型宣言。

Difference in rendering different doctypes will help you in understanding the difference in depth.

渲染不同文档类型的差异将帮助您理解深度差异。

#1


<!DOCTYPE HTML> is a HTML 5 doctype declaration,

是HTML 5 doctype声明,

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

而是一个HTML 4.01 Transitional声明。

This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed.

此DTD包含所有HTML元素和属性,包括表示元素和不推荐使用的元素(如字体)。不允许使用框架集。

So if you are using any deprecated elements from HTML 4.01, they won't work anymore when you switch to <!DOCTYPE HTML>. But if you're just keeping yourself to HTML 5 standards, you're fine. Normally you won't have this issue.

因此,如果您使用HTML 4.01中任何已弃用的元素,当您切换到时,它们将不再起作用。但是,如果您只是保持自己的HTML 5标准,那么你很好。通常你不会有这个问题。

#2


According to WHATWG <!DOCTYPE html> is recommended because it triggers standard mode in all browsers, including legacy ones. The other doctype you mentioned has simply no use anymore.

根据WHATWG推荐,因为它会在所有浏览器中触发标准模式,包括传统浏览器。你提到的另一个doctype根本就没用了。

#3


A "Document Type Declaration" is an SGML concept for signalling the mark-up syntax and vocabulary for the mark-up that follows. <!DOCTYPE html> does not conform to the requirements of that.

“文档类型声明”是SGML概念,用于发信号通知后面标记的标记语法和词汇表。 不符合要求。

This is unlike <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which is a SGML conforming Document Type Declaration.

这与不同,这是符合SGML标准的文档类型宣言。

Difference in rendering different doctypes will help you in understanding the difference in depth.

渲染不同文档类型的差异将帮助您理解深度差异。