Extensible Hypertext Markup Language

XHTML is the cleaner and stricter version of HTML. It was started in 2000 with version XHTML1.0 . XHTML 1.1 comes into existence in 2001. XHTML is very much similar to HTML 4.0.

XHTML Versions

VersionReleasing Date
XHTML 1.02000
XHTML 1.12001

XHTML Doctype

XHTML 1.0 Doctype



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		
		

Doctype of XHTML 1.1

XHTML 1.1 Doctype


						
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

		

XHTML Vs HTML

XHTML is different from HTML 4.0 in many ways. Like,

  • DOCTYPE declaration is must in an XHTML page which is written at the top of the document.
  • XHTML tags and attributes should be written in lower case only.
  • Closing tags are compulsory.
  • Values of attributes must be quoted.
  • All the tags should be properly nested.
  • All Non-pair tags should be closed with slash. e.g( < img src=" " /> , < br /> )
  • Use Id attribute instead on name in XHTML.
  • Value of attribute is must.

Except last three, all rules are followed in HTML5


HTML4 Vs XHTML Vs HTML5

HTML5 is latest version of HTML, whereas, xhtml was strict and cleaner version of HTML4. Here is a quick comparision between html4, xhtml and html5.

HTML4 XHTML HTML5
<DIV></DIV> <div></div> Both allowed, but lowercase preffered
<img src="" alt="" > <img src="" alt="" /> Both allowed, but <img src="" alt=""> is preffered
<br> <br /> <br> is preffered
<img src="" alt="" width=200 > <img src="" alt="" width="200" /> <img src="" alt="" width="200">
<input type="text" disabled > <input type="text" disabled="disabled" /> <input type="text" disabled>