English 中文(简体)
HTML 5和XHTML 1.1
原标题:HTML 5 and XHTML 1.1
  • 时间:2012-05-24 07:51:33
  •  标签:
  • html
  • xhtml

I 正在学习 HTML 5, 并有一个问题: HTML 5 能否在 XHTML 1. 1 文档中使用? 如果是, 那么任何人都能举一个例子吗?

最佳回答

不要混淆 XHTML 和 HTML 。

XHTML 是 HTML 被裁定为有效的 XML 文档。 实际上, XHTML 1. 1 标准不适用于 HTML 5, 但不适用于 HTML 4. 01 。

这意味着什么? 您可以选择一个有效的 XHTML 1. 1 文档, 它将是一个有效的 HTML 5 文档, 但对应部分并不总是真实的 。 例如 :

<button disabled></button>

有效的 HTML 代码( 与哪个版本无关), 但因空属性, 它不是一个有效的 XML 语句( 而不是有效的 XHTML 文件 ) 。 World 充满了这些例子( 只是 Google ), HTML 在语法方面非常放松( HTML 5 没有改变这个方向), 还有其他一些差异 (< href=' https:// stackoverflow.com/ sues/2158303/ in- xhtml- 1-1- ementlement- put- cannonono- be- nested- inter- ementlement- forst- why ) 。> 这里 < / a > 。 此外, HTML 5 5 标准引入了新标记, 这些标记不属于 XHTML 1. 1 标准的一部分, 所以一个 < em > hTML plitited HTM 5 5 文件( 忽略语法) 将不会成为有效的 XHTML 1. 1 文档 。

References
Here a short list of good reference about this topic, selected from SO answers:

问题回答

theoretically no, because the standard sets of xhtml and html are different. However, if it is working is totally depending on the browser you use and most modern browser will show the other set of tags as well as the standard you have defined.



上一篇:
下一篇:


相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签