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:
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:
- It is difficult to write XHTML code than HTML because of strict rules.
- 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