XHTML stands for EXtensible HyperText Markup Language. It is the next step to evolution of internet. The XHTML was developed by World Wide Web Consortium (W3C). It helps web developers to make the transition from HTML to XML. Using XHTML, developers can enter the XML world with all the features of it, and they can still remain confident about the backward and future compatibility of the content. The XHTML 1.0 is the first document type in the XHTML family and it is Recommended by W3C in 26 January 2000. The XHTML 1.1 is Recommended by W3c in 31 May 2001. The XHTML5 is a standard and is used to develop an XML adaptation of the HTML5 specification.
The XHTML documents contains three parts, which are discussed below:
- DOCTYPE: It is used to declare a DTD
- head: The head section is used to declare the title and other attributes.
- body: The body tag contains the content of web pages. It consists many tags.
Creating a XHTML web page, it is necessary to include DTD (Document Type Definition) declaration. There are three types of DTD which are discussed below:
- Transitional DTD
- Strict DTD
- Frameset DTD
Transitional DTD: It is supported by the older browsers which does not have inbuilt cascading style sheets supports. There are several attributes enclosing the body tag which are not allowed in strict DTD.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Strict DTD: Strict DTD is used when XHTML page contains only markup language. Strict DTD is used together with cascading style sheets, because this attribute does not allow CSS property in body tag.
<!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">
Frameset DTD: The frameset DTD is used when XHTML page contains frames.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Why use XHTML?
- XHTML documents are validated with standard XML tools.
- It is easily to maintain, convert, edit document in the long run.
- It is used to define the quality standard of web pages.
- XHTML is an official standard of the W3C, your website becomes more compatible and accurate with many browsers.
Benefits of XHTML:
- All XHTML tags must have closing tags and are nested correctly. This generates cleaner code.
- XHTML documents are lean which means they use less bandwidth. This reduces cost particularly if your web site has 1000s of pages.
- XHTML documents are well formated well–formed and can easily be transported to wireless devices, Braille readers and other specialized web environments.
- All new developments will be in XML (of which XHTML is an application).
- XHTML works in association with CSS to create web pages that can easily be updated.
Difference Between HTML and XHTML:
|HTML or HyperText Markup Language is the main markup language for creating web pages||XHTML (Extensible HyperText Markup Language) is a family of XML markup languages that mirror or extend versions of the widely used Hypertext Markup Language (HTML)|
|Flexible framework requiring lenient HTML specific parser||Restrictive subset of XML which needs to be parsed with standard XML parsers|
|Proposed by Tim Berners-Lee in 1987||World Wide Web Consortium Recommendation in 2000.|
|Application of Standard Generalized Markup Language (SGML).||Application of XML|
|Extended from SGML.||Extended from XML, HTML|
- p5.js | Introduction
- WML | Introduction
- PHP | Introduction
- Introduction to ES6
- Next.js | Introduction
- Introduction to LeSS
- CSS Introduction
- Hadoop - Introduction
- Deno.js | Introduction
- PHP | Spreadsheet_Excel_Writer | Introduction
- SASS | Introduction
- CoffeeScript | Introduction
- HTML | Introduction
- Introduction To AWS Lambda
- DHTML | Introduction
- Sketch.js | Introduction
- Angular 8 | Introduction
- Underscore.js | Introduction
- Introduction to Semantic UI
- REST API (Introduction)