Due to the fact that XHTML is an XML application, certain practices that were superbly legitimate in SGML-based HTML 4 must be changed. You as of now have seen XHTML punctuation in past section, so contrasts among XHTML and HTML are self-evident. Following is the correlation among XHTML and HTML.
XHTML Documents Must be Well-Formed
Well-formedness is another idea presented by XML. Basically, this implies all the components must have shutting labels and you should settle them appropriately.
Right: Nested Elements
<p>Here is an accentuated <em>paragraph</em>.</p>
Erroneous: Overlapping Elements
<p>Here is an accentuated <em>paragraph.</p></em>
Components and Attributes Must be in Lower Case
XHTML archives must utilize lower case for all HTML components and quality names. This distinction is vital in light of the fact that XHTML report is thought to be a XML record and XML is case-delicate. For instance, <li> and <LI> are various labels.
End Tags are Required for all Elements
In HTML, certain components are allowed to discard the end tag. Yet, XML doesn't permit end labels to be overlooked.
Right: Terminated Elements
<p>Here is a paragraph.</p><p>here is another paragraph.</p>
<br><hr/>
Off base: Unterminated Elements
<p>Here is a paragraph.<p>here is another passage.
<br><hr>
Quality Values Must Always be Quoted
All quality qualities including numeric qualities, must be cited.
Right: Quoted Attribute Values
<td rowspan="3">
Erroneous: Unquoted Attribute Values
<td rowspan=3>
Property Minimization
XML doesn't bolster property minimization. Trait esteem sets must be written in full. Quality names, for example, smaller and checked can't happen in components without their worth being indicated.
Right: Non Minimized Attributes
<dl compact="compact">
Mistaken: Minimized Attributes
<dl compact>
Whitespace Handling in Attribute Values
At the point when a program forms characteristics, it does the accompanying −
Strips driving and trailing whitespace.
Maps arrangements of at least one void area characters (counting line breaks) to a solitary between word space.
Content and Style Elements
In XHTML, the content and style components ought not have "<" "and" characters straightforwardly, on the off chance that they exist; at that point they are treated as the beginning of markup. The substances, for example, "<" "and" are perceived as element references by the XML processor for showing "<" "and" characters separately.
Wrapping the substance of the content or style component inside a CDATA checked area maintains a strategic distance from the development of these elements.
<script type="text/JavaScript">
<![CDATA[
... unescaped VB or Java Script here... ...
]]>
</script>
An option is to utilize outer content and style reports.
The Elements with id and name Attributes
XHTML prescribes the supplanting of name property with id characteristic. Note that in XHTML 1.0, the name characteristic of these components is officially deplored, and it will be evacuated in a consequent renditions of XHTML.
Qualities with Pre-characterized Value Sets
HTML and XHTML both have a few qualities that have pre-characterized and constrained arrangements of qualities. For instance, type property of the information component. In HTML and XML, these are called specified qualities. Under HTML 4, the translation of these qualities was case-unfeeling, so an estimation of TEXT was comparable to an estimation of content.
Under XHTML, the understanding of these qualities is case-touchy so these qualities are characterized in lower-case.
Element References as Hex Values
HTML and XML both license references to characters by utilizing hexadecimal worth. In HTML these references could be made utilizing either &#Xnn; or &#xnn; and they are legitimate however in XHTML records, you should utilize the lower-case form just, for example, &#xnn;.
The <html> Element is a Must
All XHTML components must be settled inside the <html> root component. Every single other component can have sub components which must be two by two and effectively settled inside their parent component. The fundamental report structure is −
<!DOCTYPE html....>
<html>
<head> ... </head>
<body> ... </body>
</html>