XHTML和HTML之间有什么区别?

时间:2021-07-16 16:20:54

What is the exact difference between HTML and XHTML?

HTML和XHTML的确切区别是什么?

I have seen related posts here, but I am not getting it exactly.

我在这里看到过相关的帖子,但我没有得到确切的消息。

4 个解决方案

#1


53  

XHTML is not so much different from HTML 4.01 standard. The major differences are:

XHTML与HTML 4.01标准没有太大的不同。主要区别是:

  • XHTML elements must be properly nested.
  • XHTML元素必须正确地嵌套。
  • XHTML elements must always be closed.
  • XHTML元素必须始终关闭。
  • XHTML elements must be in lowercase.
  • XHTML元素必须是小写的。
  • XHTML documents must have one root element.
  • XHTML文档必须有一个根元素。

Basically, XHTML is HTML (all the html tags are found in XHTML) that follows the rules of XML (because it is a family of XML).

基本上,XHTML是HTML(在XHTML中可以找到所有的HTML标记),遵循XML规则(因为它是XML家族)。

More references can be found on:

更多的参考资料可在:

#2


11  

XHTML is an application of XML, which is quite a strict angle-bracket language.

XHTML是XML的一种应用,它是一种非常严格的角括号语言。

HTML is an application of SGML, which is a much less strict angle-bracket language.

HTML是SGML的一个应用程序,它是一种不那么严格的角括号语言。

(XML is also an application of SGML.)

(XML也是SGML的一个应用)

At one time, people hoped that the solution to the mess of the late 90s web markup was to persuade everyone to write XHTML rather than HTML, perhaps in the hope that the enforced discipline would transform all those polo-necked frameless-spectacle wearing graphic designers into computer programmers. Alas, there was not actually much demonstrable benefit to all this exhausting prostration at the altar of the XHTML validator, so XHTML is now out of fashion and HTML is back in.

曾几何时,人们希望解决90年代末web标记混乱的办法是说服每个人都编写XHTML而不是HTML,也许是希望强制的规则能够将所有那些戴着图形设计人员的无框眼镜变成计算机程序员。唉,实际上,在XHTML验证器的祭坛上,所有这些令人筋疲力尽的简化并没有带来什么明显的好处,因此XHTML现在已经过时了,HTML又重新流行起来。

#3


6  

XHTML will be treated an application of XML only in case where MIME type application/xhtml+xml, application/xml, or text/xml are used. An XHTML document served with a MIME type of text/html must be parsed and interpreted as HTML, so the HTML rules apply in this case.

只有在使用MIME类型应用程序/ XHTML + XML、应用程序/ XML或文本/ XML时,XHTML才会处理XML的应用程序。使用文本/html的MIME类型提供服务的XHTML文档必须被解析并解释为html,因此在本例中应用html规则。

Check this link for more on difference between XHTML and HTML

请查看此链接以了解XHTML和HTML之间的更多差异

#4


-2  

  1. XHTML is case sensitive, different from HTML.
  2. XHTML区分大小写,与HTML不同。
  3. XHTML's tags must be opened and closed different from HTML where a tag can be left as open.
  4. XHTML的标记必须打开和关闭,这与HTML不同,在HTML中标记可以保持打开状态。
  5. XHTML is not browser-dependent and can run on any browser platform, unlike HTML.
  6. 与HTML不同,XHTML不依赖浏览器,可以在任何浏览器平台上运行。

#1


53  

XHTML is not so much different from HTML 4.01 standard. The major differences are:

XHTML与HTML 4.01标准没有太大的不同。主要区别是:

  • XHTML elements must be properly nested.
  • XHTML元素必须正确地嵌套。
  • XHTML elements must always be closed.
  • XHTML元素必须始终关闭。
  • XHTML elements must be in lowercase.
  • XHTML元素必须是小写的。
  • XHTML documents must have one root element.
  • XHTML文档必须有一个根元素。

Basically, XHTML is HTML (all the html tags are found in XHTML) that follows the rules of XML (because it is a family of XML).

基本上,XHTML是HTML(在XHTML中可以找到所有的HTML标记),遵循XML规则(因为它是XML家族)。

More references can be found on:

更多的参考资料可在:

#2


11  

XHTML is an application of XML, which is quite a strict angle-bracket language.

XHTML是XML的一种应用,它是一种非常严格的角括号语言。

HTML is an application of SGML, which is a much less strict angle-bracket language.

HTML是SGML的一个应用程序,它是一种不那么严格的角括号语言。

(XML is also an application of SGML.)

(XML也是SGML的一个应用)

At one time, people hoped that the solution to the mess of the late 90s web markup was to persuade everyone to write XHTML rather than HTML, perhaps in the hope that the enforced discipline would transform all those polo-necked frameless-spectacle wearing graphic designers into computer programmers. Alas, there was not actually much demonstrable benefit to all this exhausting prostration at the altar of the XHTML validator, so XHTML is now out of fashion and HTML is back in.

曾几何时,人们希望解决90年代末web标记混乱的办法是说服每个人都编写XHTML而不是HTML,也许是希望强制的规则能够将所有那些戴着图形设计人员的无框眼镜变成计算机程序员。唉,实际上,在XHTML验证器的祭坛上,所有这些令人筋疲力尽的简化并没有带来什么明显的好处,因此XHTML现在已经过时了,HTML又重新流行起来。

#3


6  

XHTML will be treated an application of XML only in case where MIME type application/xhtml+xml, application/xml, or text/xml are used. An XHTML document served with a MIME type of text/html must be parsed and interpreted as HTML, so the HTML rules apply in this case.

只有在使用MIME类型应用程序/ XHTML + XML、应用程序/ XML或文本/ XML时,XHTML才会处理XML的应用程序。使用文本/html的MIME类型提供服务的XHTML文档必须被解析并解释为html,因此在本例中应用html规则。

Check this link for more on difference between XHTML and HTML

请查看此链接以了解XHTML和HTML之间的更多差异

#4


-2  

  1. XHTML is case sensitive, different from HTML.
  2. XHTML区分大小写,与HTML不同。
  3. XHTML's tags must be opened and closed different from HTML where a tag can be left as open.
  4. XHTML的标记必须打开和关闭,这与HTML不同,在HTML中标记可以保持打开状态。
  5. XHTML is not browser-dependent and can run on any browser platform, unlike HTML.
  6. 与HTML不同,XHTML不依赖浏览器,可以在任何浏览器平台上运行。