In 1998, the W3C introduced the Extensible Markup Language(XML)which is a restricted version of SGML.then a new version of HTML came up,which is called XHTML.(eXtensible Hypertext Markup Language).The syntaxes of XHTML are defined using XML,rather than SGML.
The XHTML is syntactically identical to HTML.but XHTML follows certain restrictions.these restrictions are mentioned by following difference.
Difference between HTML and XHTML
HTML XHTML
1)HTML is Hypertext Markup 1)XHTML is Extensible
language. Hypertext Markup Language.
2)An application of SGML 2)An application of XML.
3)Can have empty/open tags 3)All the unclosed tags must be
eg:<br>,<p> closed.eg:<br/>,<p>,</p>
4)No hard rule on structures 4)Structure of the elements
of the elements eg:<p><b> should be followed e.g <p>
the difference</p></b> <b>the difference</b></p>
5)Attributes have quotes as 5)Attributes have quotes
optional e.g: mandatory eg:
<font color=#ff0000> <font color=#ff0000?>
6)Attributes values not 6)Attributes values are
significant. e.g: important.e.g:
<input type="checkbox"checked> <input type="checkbox"
checked="checked">
7)Case Sensitive:The tags and 7)Case Sensitive:The tags and
attributes can be of uppercase attributes must be of
or lowercase as per the lowercase
preference.
8)All the content can be put 8)All the content has to be put
under body element in blocks(p under body
element)
9)HTML is not mandatory 9)XHTML document must
for one root element have one root element.
The relationship between SGML,XML,HTML and XHTML is as given below
------------- superset of --------------
- SGML - ----------------->-XML -
------------- --------------
: :
:derives : Derives
: :
------------- superset of ---------------
-HTML - ------------------>- XHTML-
------------- ---------------
: :
: :
: :
------------- ---------------
| SGML | | XML |
| tool - |<--------------------| tool |
-------------- --------------