HTML 5与XHTML 1.0 Transitional? [英] HTML 5 versus XHTML 1.0 Transitional?

查看:76
本文介绍了HTML 5与XHTML 1.0 Transitional?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



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

解决方案

一般来说,HTML是SGML,而XHTML是用XML表示的。因此,创建XHTML与HTML相比具有更多限制(以标记的形式)。 ( SGML基于XML的HTML



正如


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

在给定的实现状态(AFAIK,标准甚至没有解决,但是正确吗?)中使用HTML 5或XHTML 5可能会适得其反所有用户都可能看不到网站呈现correclty无论如何。

编辑2013:
由于最近dowvotes,并且由于这个接受的答案不能被删除(由我) ,我想补充一点,HTML5的支持和标准化过程现在与五年前我写这个答案时的情况完全不同。由于大多数主流浏览器支持HTML5草稿的大部分内容,并且由于很多内容可以在旧版浏览器中用polyfills修复,我现在主要使用HTML5。


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?

Video on HTML 5: http://www.youtube.com/watch?v=xIxDJof7xxQ

解决方案

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 <video> or <audio> 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 5与XHTML 1.0 Transitional?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆