是否有多个一页上的元素标签会导致问题
我今天遇到了这个具体情况。在客户的网站上,页面有多个标签,有些甚至具有冲突的文档类型: 例如:
<!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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这会导致的问题是它是无效的 HTML 并且不确定如何呈现内容。
The problem that this will cause is that it is invalid HTML and it is indeterminate how the content will be rendered.
这几乎是标准的“网络”答案,但基本上这取决于浏览器如何处理它。它显然不符合标准的 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.
除此之外它实在是丑陋且不标准,
以前它肯定会导致浏览器出现问题,我不知道现在常见的浏览器的行为如何。
我记得有一天,有人尝试使用具有不同背景颜色的多个主体标签来创建闪烁的背景效果:)
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 :)