What is difference between XHTML and HTML? [closed]

谁都会走 提交于 2020-03-12 07:18:04

问题


What is the exact difference between HTML and XHTML?

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


回答1:


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

  • XHTML elements must be properly nested.
  • XHTML elements must always be closed.
  • XHTML elements must be in lowercase.
  • XHTML documents must have one root element.

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).

More references can be found on:

  • W3Schools.
  • Wikipedia.
  • Sitepoint.com.



回答2:


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

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

(XML is also an application of 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.




回答3:


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.

Check this link for more on difference between XHTML and HTML




回答4:


  1. XHTML is case sensitive, different from HTML.
  2. XHTML's tags must be opened and closed different from HTML where a tag can be left as open.
  3. XHTML is not browser-dependent and can run on any browser platform, unlike HTML.


来源:https://stackoverflow.com/questions/4153403/what-is-difference-between-xhtml-and-html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!