XHTML is used to make HTML more extensible and increase interoperability with other data formats.
- Reduce incompatibility between browsers
- Creates a standard that can be used on a variety of devices without changes
Bad HTML Example
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"
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.