XHTML/HTML vs. XHTML

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Despite what the title may suggest, the aim of this module is not state which version is "better". Each language has a specific use cases, and this guide simply exists to clarify these scenarios.

What are the Differences Between the Two?[edit | edit source]

Syntax[edit | edit source]

XHTML has a stricter, XML-based syntax that does not appear in HTML, therefore making it slightly more advanced for new users.

The most important change is that there are no unpaired tags such as or <->.As such, there is now a corresponding closing tag, or the tag is immediately closed within the tag itself. + JavaCorehtml5

Which Version is Right For Me?[edit | edit source]

(This section is only meant to highlight the positives for each language.)

The Case for HTML5[edit | edit source]

You should use HTML if the following conditions are met:

  • I want cross-compatibility without resorting to complex methods.
  • I want to use the most established, thus most bug-free version of HTML.
  • I want more flexibility when it comes to error-handling.

The Case for XHTML[edit | edit source]

You should use XHTML if the following conditions are met:

  • I want to take advantage of XML applications such as MathML and XSL.
  • I want to take advantage of XML's more efficient parsing processing.
  • I want to use XHTML's inherent extensibility to create custom elements.