What Is XHTML | Differences between XHTML and HTML


XHTML

XHTML stands for extensible Hypertext Markup Language. It combines the  formatting strengths of HTML 4.0 and the data structure and extensibility strengths of XML. it uses the tags and attributes of HTML along with the syntax of XML. The first version of  XHTML 1.0 was released in 2000. The World Wide Web Consortium (W3C) sets standards for XHTML and other internet languages. XHTML was created for two main reasons:

To create a more strict standard for making web pages and reduce incompatibilities between browsers.

To create a standard that can be used on different devices without changes.

Changes in XHTML from HTML

There are several main changes in XHTML from HTML:

• All tags must be in lower case
• All documents must have a doctype
• All documents must be properly formed
• All tags must be closed
• All attributes must be added properly
• The name attribute has changed
• Attributes cannot be shortened
• All tags must be properly nested

Flavors of XHTML 1.0

Three flavors of XHTML 1.0 are as follows:

XHTML Transitional
XHTML Frameset
XHTML Strict

XHTML Transitional

The most commonly used version of XHTML is 1.0·This version mostly resembles with HTML 4.0.1. It is the best choice when documents need to use HTMLs presentational elements or when pages need to be developed without using style sheets. This version is used to convert existing HTML pages to XHTML. It also does not provide support for frames.

XHTML Frameset

XHTML Frameset version should be used when the documents need to use the frame elements to divide the browser into multiple windows. It also supports the element set of XHTML Transitional.

XHTML Strict

XHTML Strict most closely represents the future of XHTML. The element set for XHTML Strict
contains a subset of the element from XHTML Transitional. However, it does not support for strictly presentational elements and elements that will not be documents will separate such as font XHTML Strict contains a subset of the elements from XHTML Transitional included in future versions of XHTML. In, the future, XHTML presentation from content and use style sheets to define presentation formatting types, colors and styles. XHTML Strict should be used with Cascading Style Sheets (CSS).

Differences between XHTML and HTML

The difference between XHTML and HTML is as follows:

• XHTML documents contain the XML and DOCTYPE declarations at the top of the document. XML declaration is optional but DOCTYPE declaration is required. The DOCTYPE declaration was optional in HTML. XHTML requires that all WebPages contain <HTML>, <HEAD>, <BODY> elements.

• XHTML documents must be well formed. However, HTML does not strictly require well formed documents.

• XHTML requires closing tag for every element. HTML does not require closing tags.

• XHTML requires that all attributes should be enclosed in quotation marks. HTML does not require quotation marks. However, they are required around attribute values that consist of only letters, numbers and the characters dash, period underscore and colon.

• XHTML elements and attributes are case sensitive but HTML elements and attributes are not.