xhtml1.0 html5,HTML 5与XHTML 1.0过渡?(HTML 5 versus XHTML 1.0 Transitional?)

本文探讨了HTML5与XHTML1.0 Transitional之间的差异,尤其是在新引入的视频和音频标签方面。文章讨论了如何在不同文档类型定义(DTD)下正确使用这些标签,以及HTML5和XHTML5之间的兼容性和使用建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HTML 5与XHTML 1.0过渡?(HTML 5 versus XHTML 1.0 Transitional?)

看来HTML 5将被Firefox 3.1和其他浏览器支持(部分)。 它正在添加对视频和音频作为标签的支持,但这些是XHTML 1.0 Transitional不能识别的新标签。 如果在未来版本的Firefox中使用新的HTML 5标签,但是使用DTD作为XHTML,该行为应该是什么? 如果我将HTML 5标记与XHTML 1.0 Trans混合在一起?

这是令人困惑的。 他们为什么不把这些标签添加到XHTML? 我们如何支持XHTML和HTML 5?

HTML 5上的视频: http : //www.youtube.com/watch?v=xIxDJof7xxQ

It seems that HTML 5 is going to be supported (partially) by Firefox 3.1 and other browsers. It is adding support for video and audio as tags, but these are new tags that XHTML 1.0 Transitional does not recognize. What is the behavior supposed to be if I use a new HTML 5 tag in a future version of Firefox but use the DTD for XHTML? And what if I mix HTML 5 markup with XHTML 1.0 Trans?

This is getting confusing. Why didn't they just add these tags to XHTML? How do we support both XHTML and HTML 5?

原文:https://stackoverflow.com/questions/256953

更新时间:2019-11-06 12:50

最满意答案

那么一般来说,HTML是SGML,XHTML以XML表示。 因此,创建XHTML与HTML有更多限制(以标记的形式)相连接。 ( 基于SGML和基于XML的HTML )

如维基百科上所述 ,HTML 5也将有一个XHTML变体(XHTML 5)。

经验法则:您应该始终使用有效的标记。 这也意味着您不应该使用XHTML 1.0 Transitional中提到的或标签,因为它们不是该规范的元素。 如果您真的需要使用这些标签(我非常怀疑),那么您应该确保使用HTML 5 / XHTML 5 DTD来指定您的文档在该DOCTYPE中。

在给定的实施状态(AFAIK,标准甚至没有解决,但是正确的)中使用HTML 5或XHTML 5可能会产生反效果,因为几乎所有用户可能看不到网站呈现相关性。

编辑2013:由于最近的downvote,由于这个接受的答案不能被删除(由我),我想补充说,HTML5的支持和标准化过程现在完全不同于我五年前写这个答案是什么。 由于大多数主流浏览器支持HTML5草案的大多数部分,并且由于可以使用旧版浏览器中的多重文字填充大量内容,因此我现在主要使用HTML5。

Well, generally speaking HTML is SGML and XHTML is expressed in XML. Because of that, creating XHTML is connected with more restrictions (in the form of markup) than HTML is. (SGML-based versus XML-based HTML)

As mentioned on Wikipedia, HTML 5 will also have a XHTML variant (XHTML 5).

Rule of thumb: You should always use valid markup. That also means that you should not use the mentioned or tags in XHTML 1.0 Transitional, as those are not an element of that specification. If you really need to use those tags (which I highly doubt), then you should make sure that you use the HTML 5/XHTML 5 DTD in order to specify that your document is in that DOCTYPE.

Using HTML 5 or XHTML 5 in the given state of the implementation (AFAIK, the standard is not even settled, yet, correct?) could be counter-productive, as almost all users may not see the website rendered correclty anyways.

Edit 2013: Because of the recent downvotes and since this accepted answer cannot be deleted (by me), I would like to add that the support and standardization process of HTML5 is nowadays totally different to what it was when I wrote this answer five years ago. Since most major browsers support most parts of the HTML5 draft and because a lot of stuff can be fixed with polyfills in older browsers, I mainly use HTML5 now.

相关问答

您的代码显示您:

使用母版页(HTML声明的位置)

使用内容 页面 占位符来添加和整个HTML文档 - 您不应该这样做。 如上所述,母版页是HTML声明的地方 ASP.net内容部分仅供内容使用。 Y

...

不,它确实无效。 如果要在XHTML文件中使用内联JavaScript,则需要将JavaScript包装在CDATA中 。 如果你不想这样做,那么你就会遇到编码&,,这在JavaScript中会非常麻烦。 No, it is indeed not valid. If you want to use in-line JavaScript in an XHTML file, you'll need to wrap the JavaScript in CDATA. If you don't wan

...

那么一般来说,HTML是SGML,XHTML以XML表示。 因此,创建XHTML与HTML有更多限制(以标记的形式)相连接。 ( 基于SGML和基于XML的HTML ) 如维基百科上所述 ,HTML 5也将有一个XHTML变体(XHTML 5)。 经验法则:您应该始终使用有效的标记。 这也意味着您不应该使用XHTML 1.0 Transitional中提到的或标签,因为它们不是该规范的元素。 如果您真的需要使用这些标签(我非常怀疑),那么您应该确保使用HTML 5 /

...

HTML dtd非常庞大,使用包含。 而你是对的,他们永远。 使用XML目录 。 可以在本地存储dtd并按系统ID映射它们。 如果你使用像maven这样的工具,你会找到足够的指针。 作为@sylvainulg链接的答案,拦截实体的优点是,您收到了正确的字符。 HTML dtd's are huge, using includes. And you are right, they take forever. Use an XML catalog. There one can store the dt

...

XHTML 1.0建议书本身在兼容性指南中说明了第4项 :“如果你的脚本使用

...

除了Francois的答案中确定的少数几种语言变化之外,主要区别在于技术性。 XHTML 1.0被部分定义为一个中间步骤,以允许Web作者从HTML4转换为XHTML语法。 XHTML 1.1将语言重新组合为一系列模块,作为规范编写者未来语言开发的框架,允许各个部分在独立的编辑和工作组中进行,每个编辑和工作组都可以按照自己的步调进步。 您可以看到与CSS 3相同的模块化过程。 模块化是一件好事还是有用的事情是一个意见问题,并且有一些证据表明,规范模块化不能很好地工作。 正如它发生的那样,随着下一个

...

Web表单规范与HTML 4 / XHTML无关。 不幸的是, autocomplete不会通过验证。 我认为关闭自动完成功能来实现有效HTML 4 / XHTML的唯一方法是使用JavaScript在页面加载中添加属性。 糟透了,我知道 - 但我认为这是唯一的方法。 The Web forms specification has nothing to do with HTML 4 / XHTML. Sadly, autocomplete will not pass validation. I t

...

(并且验证会告诉你这个)但是 (你在编辑之前)不是。 但是,除非您将其与表单控件相关联(通过for属性或将表单控件作为label元素的后代放置),否则它是无用的。 (and validating would have told you this) is but (which you had before editing) is not. It is, however, useless unless you associate it wi

...

你读过完整的错误说明了吗? 例如,在HTML中,

元素必须包含子元素 看起来你没有元素。 Did you read the full error explanation? For instance, in HTML the element must contain a child element Looks like you don't have the element.

这是一个结构合理的版本:

The HTML5

Is Your County Obese?

Select your county to see how it

...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值