Differences between HTML and XHTML

HTML, which stands for Hyper Text Markup Language, is a descriptive language. XHTML, which stands for Extensible HyperText Markup Language, is also a descriptive language, similar to HTML in terms of presentation, but with stricter syntax. In terms of relationship, HTML is an application based on the Standard Generalized Markup Language (SGML), XML is a subset of SGML, and XHTML is based on XML.

Language Basics

  • XHTML is based on the Extensible Markup Language (XML).
  • HTML is based on the Standard Generalized Markup Language (SGML).

Strictness of Syntax

  • HTML has looser syntax requirements.
  • XHTML requires elements to be closed, including empty tags.
  • XHTML tag names must be in lowercase.
  • XHTML documents must have a root element.
  • XHTML tag order must be correct.
  • XHTML documents require all attributes to have a value, and attribute values cannot be abbreviated.
  • XHTML requires all attributes to be enclosed in double quotation marks ("").
  • XHTML documents need to encode special characters such as <, >, &, etc.
  • XHTML documents cannot use -- in comment content.
  • XHTML images must have alt text.
  • XHTML documents use the id attribute instead of the name attribute.

Hybrid Applications

  • XHTML can incorporate various XML applications, such as MathML and SVG.
  • HTML4.0 cannot incorporate other XML applications, but in HTML5, it is possible to embed applications such as MathML and SVG.

Daily Question

https://github.com/WindrunnerMax/EveryDay

References

https://www.zhihu.com/question/19783105 https://www.zhihu.com/question/19818208 https://www.cnblogs.com/sunhuinaxixi/p/12257633.html