# Understanding the Key differences Between HTML, XML, and XHTML
**Introduction**
A markup language is a set of rules that defines how text and images are structured within a digital document. Essentially, it controls the document's layout. Markup languages enable the structuring of documents, the addition of formatting, and the specification of how different elements should be displayed on webpages.
HTML is the most widely used markup language. However, HTML is not the only one. Other prominent examples include XML, and XHTML. While they share some commonalities, each has its own distinct purpose and set of rules. In this article, we will examine the key differences between HTML, XHTML, and XML, including both their syntax and code examples.
**HTML (HyperText Markup Language)**
HTML, or HyperText Markup Language, is currently the standard markup language used to create and structure the content of webpages. It is used to present information to users in a visually appealing and interactive format.
HTML defines the basic structure of a web page. It contains meta-data about the page and a series of elements to be displayed on the web page. HTML uses predefined tags such as `<div>`, `p`, `<table>` etc. to render elements on the webpage.
**Key Features of HTML**
* Browser-Centric: HTML is designed for interpretation and rendering by web browsers.
* Predefined Tags: HTML Utilizes a set of tags for structuring elements.
* Less Strict Syntax
* Easy to learn
* Supports audio, video, and image embedding
* Supported by all major browsers
* Allows integration with styling (CSS) and scripting (JavaScript) languages.
**Basic Structure of HTML Code**
```html=
<!DOCTYPE html>
<html>
<head>
<title>Chinemerem Web Page</title>
</head>
<body>
<h1>Welcome to my website!</h1>
<p>I aspire to be a blockchain developer</p>
</body>
</html>
```
**XML (Extensible Markup Language**)
Unlike HTML used to display web pages to users, XML is designed to act as a meta-language, meaning it provides a framework for creating other specialized markup languages. It is used for storing structured data.
XML uses custom tags to define the elements which support a wide range of elements. It was developed because HTML was unable to define new elements. It is used for storing and transporting data and it contains information about the sender, receiver, heading, and message body. It is used for representing documents, data, transactions, invoices, etc.
**Key Features of XML**
* Very flexible.
* XML is data-Centric
* It has a very strict syntax
* Efficient data exchange
* Works across various software and hardware environments.
* Integrates easily with other markup languages.
**Basic Code Structure of XML**
```html=
<?xml version="1.0" encoding = "UTF-8"?>
<message>
<to>Chioma</to>
<from>Chinemerem</from>
<subject>Welcome to my page</subject>
<text>Happy surfing the net</text>
</message>
```
**XHTML (Extensible Hypertext Markup Language)**
XHTML is an attempt to bridge the gap between the flexibility of HTML and the strict structure of XML. It essentially aimed to bring the well-defined rules of XML to the world of web page development. It is more strict than HTML in terms of error handling. It specifies some mandatory tags such as `<!DOCTYPE>`, `<html>`, `<head>`, `<title>`, and `<body>` that should be present in the document. XHTML is HTML written in XML syntax. This means it follows the strict rules and guidelines of XML.
**Key Features of XHTML**
* XML-Based: XHTML follows the strict rules and guidelines of XML.
* Stricter Rules: XHTML enforces strict rules for syntax and structure.
* It ensures a clean, consistent, and well-structured document format.
* It is compatible across different browsers.
* It is more easily processed by a wider range of software and devices.
**Basic Code Structure of XHTML**
```html=
<?xml version="1.0" encoding="UTF-8"?>
<!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>Chinemerem XHTML Page</title>
</head>
<body>
<h1>Welcome to my XHTML page!</h1>
<p>Enjoy your stay here.</p>
</body>
</html>
```
**Resources**
What Is Markup Language? Examples, Types & Definition
https://www.semrush.com/blog/markup-language/
Explain different markup languages other than HTML
https://www.geeksforgeeks.org/explain-different-markup-languages-other-than-html/