Why XHTML?

XHTML is used to make HTML more extensible and increase interoperability with other data formats.

XHTML Advantages

  • Reduce incompatibility between browsers
  • Creates a standard that can be used on a variety of devices without changes
Bad HTML Example
<html>  
<head>  
  <title>Bad HTML</title>  
<body>  
  <h1>Bad HTML  
  <p>paragraph  
</body>
HTML code works fine in most of the browsers, but code does not follow the HTML rules. In today's market, some browsers run on computers, and some browsers run on mobile phones or other small devices. Smaller devices often lack the resources or power to interpret "bad" markup. So, XHTML is introduced to create better formatted code on our site. Good XHTML Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">    
<head><title>Good XHTML</title></head>  
<body>  
<h1>Good XHTML</h1>  
<p>paragraph? </p>  
</body>  
</html>

Basic Understanding of SGML and XML

SGM stands for Standard Generalized Markup Language. This language is used for describing markup languages that is used in electronic document exchange, document management and document publishing. HTML is an example of a SGML language. XML stands for EXtensible Markup Language. XML is a markup language that is used to describe data or information. In XML, tags are not predefined.