XHTML

Extensible Hypertext Markup Language (XHTML) is a markup language that is used to create HTML documents that support custom tags to define new elements. It is more strict than HTML in terms of error handling i.e browser doesn’t display web pages in case of errors in the markup document. It creates an XML version of the HTML document which must be marked up correctly.
It specifies some mandatory tags such as
<!DOCTYPE>, <html>, <head>, <title>, and <body> that should be present in the document. Also <html> tag should contain xmlns attribute in case of XHTML. It is necessary to include DTD (Document Type Definition) declaration in XHTML web page. There are three types of DTD as follows.

  • Transitional DTD
  • Strict DTD
  • Frameset DTD

Example: Implementation of the basic structure of the XHTML code.

XML




<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  
<head>
    <title>XHTML</title>
</head>
  
<body>
    <div style="color:#090;font-size:40px;
            font-weight:bold;text-align:center;
            margin-bottom:-25px;">w3wiki</div>
    <p style="text-align:center;font-size:20px;">
        A computer science portal
    </p>
</body>
  
</html>


Output:

Output for XHTML code

Features:

  • XHTML is built on XML, offering a structured and extensible markup.
  • It simplifies document maintenance, conversion, and editing.
  • XHTML enforces strict rules for syntax and structure.
  • XHTML ensures a clean, consistent, and well-structured document format.
  • It is compatible and accurate across various browsers.

Drawbacks:

  1. It is difficult to write XHTML code than HTML because of strict rules.
  2. It does have the solution for cross-browser combability issues.

Explain different markup languages other than HTML

Markup languages are computer languages that are used to structure, format, or define relationships between different parts of text documents with the help of symbols or tags inserted in the document. These languages are more readable than usual programming languages with strict syntax. There are several markup languages available but the most popular among them are as follows.

Table of Content

  • HTML
  • XML
  • XHTML
  • SGML

Similar Reads

HTML:

Hypertext Markup Language (HTML) is a markup language used to create and link webpages. It defines the basic structure of a web page and contains meta-data about the page and a series of elements to be displayed on the web page. It uses predefined tags such as

, , etc. to render different elements on the webpage. Each element requires a starting and ending tag with content inside it. A marked-up document written in HTML is displayed by a web browser that interprets different tags and accordingly formats and structures the content of the document before displaying it. It can be written in a plain text editor and can be associated with styling sheets such as CSS (Cascading Style Sheets)  and scripting languages such as JavaScript....

XML:

...

XHTML:

Extensible Markup Language (XML) is a markup language used for storing structured data. It 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 hence XML was introduced which was extensible to define custom elements. It was designed to store and transport data and contain information about the sender, receiver, heading, and message body. It is more focused on what data is rather than how data looks. It is used for representing documents, data, transactions, invoices, etc....

SGML:

...