简体   繁体   English

HTML 5是HTML 4.01 Transitional的超集吗?

[英]Is HTML 5 a superset of HTML 4.01 Transitional?

We have a PHP framework which was originally written in 2005, and consequently the default DOCTYPE is HTML 4.01 Transitional . 我们有一个最初于2005年编写的PHP框架,因此默认的DOCTYPE是HTML 4.01 Transitional

Whilst this can be overridden, most projects (even recent ones) have not changed the default, and so most projects will be serving documents as HTML 4. 尽管可以覆盖此设置,但大多数项目(甚至是最近的项目)都没有更改默认值,因此大多数项目将以HTML 4格式提供文档。

All HTML generated by the framework has been designed to pass the W3C HTML 4 Validator, and most projects will also be generating valid HTML as this is a company requirement (though exceptions are allowed where necessary, eg use of some new HTML elements like <canvas> which would fail the HTML 4 validation but which browsers all nevertheless handle correctly). 框架生成的所有HTML都经过设计,可以通过W3C HTML 4验证程序,并且大多数项目也将生成有效的HTML,因为这是公司的要求(尽管在必要时允许例外,例如使用一些新的HTML元素,例如<canvas>会导致HTML 4验证失败,但所有浏览器都能正确处理)。

My question: If I simply switch the framework to use a modern DOCTYPE will the HTML 4 mark-up validate correctly as HTML 5, or will I also need to make changes to the code? 我的问题:如果仅将框架切换为使用现代DOCTYPE,HTML 4标记将正确地验证为HTML 5,还是我还需要对代码进行更改?

A secondary question: Will rendering or browser support be affected by this change? 另一个问题:渲染或浏览器支持会受到此更改的影响吗?

If I am reading this wikipedia article correctly then all browsers will be going from Quirks mode to Standards mode. 如果我正确阅读了此Wikipedia文章,则所有浏览器都将从Quirks模式转到Standards模式。 This means that browser rendering is likely to be affected. 这意味着浏览器渲染可能会受到影响。

I don't know about the validation, but since rendering will be affected it is a safe bet to assume the validation will as well. 我对验证一无所知,但是由于渲染会受到影响,因此假设验证也将是一个安全的选择。

Interesting reading: 有趣的阅​​读:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM