开发者

What is difference between XHTML and HTML? [closed]

开发者 https://www.devze.com 2023-01-24 07:23 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, argu开发者_如何学运维ments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

What is the exact difference between HTML and XHTML?

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


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.


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.


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


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

精彩评论

暂无评论...
验证码 换一张
取 消