是否有多个一页上的元素标签会导致问题

发布于 2024-10-07 12:35:19 字数 511 浏览 0 评论 0原文

我今天遇到了这个具体情况。在客户的网站上,页面有多个标签,有些甚至具有冲突的文档类型: 例如:

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

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

所有这些都在同一页面内。

这会导致任何问题吗?如果会的话,会导致哪些问题?

I cam accross this specific situation today. On a client's website, the pages had multiple tags, some even with conflicting Doctypes:
Ex:

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

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

All this within the same page.

Will this cause any issues, if so which ones ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鱼忆七猫命九 2024-10-14 12:35:19

这会导致的问题是它是无效的 HTML 并且不确定如何呈现内容。

The problem that this will cause is that it is invalid HTML and it is indeterminate how the content will be rendered.

淡淡離愁欲言轉身 2024-10-14 12:35:19

这几乎是标准的“网络”答案,但基本上这取决于浏览器如何处理它。它显然不符合标准的 HTML,因此最好避免它。

This is pretty much the standard "web" answer, but basically it depends on how the browser handles it. It's obviously not standards-compliant HTML so it would be good to avoid it.

_畞蕅 2024-10-14 12:35:19

除此之外它实在是丑陋且不标准,
以前它肯定会导致浏览器出现问题,我不知道现在常见的浏览器的行为如何。

我记得有一天,有人尝试使用具有不同背景颜色的多个主体标签来创建闪烁的背景效果:)

apart from that it is plain ugly and non-standard,
it has surely caused browser hickups in browser before, i dont know how the common browsers behave today.

i recall the day when one experimented with multiple body tags with different bgcolors to create a blinking background effect :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文