是否可以将HTML5元素与旧的HTML4一起使用?
问题描述:
我在网页中使用了video
元素,但是DOCTYPE是HTML4.
I've used the video
element in my web page but the DOCTYPE is HTML4.
然后,我也可以在HTML5中使用frameset
.
Then, I can use frameset
in HTML5 also.
为什么对标签的使用没有限制?
Why there is no restriction on tag usage?
答
HTML旨在容忍错误.使用特定的文档类型不会使浏览器拒绝发布该文档类型时不存在的标签.
HTML is designed to be tolerant of errors. Using a particular doctype won’t make browsers reject tags that weren’t around when that doctype was published.
这就是为什么当前HTML文档类型仅为<!DOCTYPE html>
,即未版本控制的原因.它更准确地将HTML反映为不断发展的标准.
This is why the current HTML doctype is just <!DOCTYPE html>
, i.e. unversioned. It more accurately reflects HTML as an ever-evolving standard.