XHTML (Extensible Hypertext Markup Language), roughly speaking, is a markup language that allows you to edit websites. It is based on HTML 4.01, but its rules are much stricter and more versatile than HTML. XHTML is a new formulation of HTML using the meta markup language XML, which is a key advantage in its usability because many data formats are based on XML and modern devices require a strict version of markup language because they cannot display bad source code.
XHTML has been designed to extend HTML and allow compatibility with newer data formats such as videos, images, or scripting languages. Since HTML was always based on SGML and was thus relatively complex, a limited meta markup language such as XML was found to be suitable to define the basic structure and the syntactic possibilities of XHTML. The specifications of XHTML 1.0 were published by the W3C in 2002. At the end of 2009 the work on version 2.0 was discontinued because the Web Hypertext Application Technology Working Group (WHATWG) was working on HTML5 at the same time which in the end prevailed.
XHTML is used to mark up content such as text, images, and links in the form of Hyperlinks to create a certain structure that can be displayed by Browsers. Documents can be structured with XHTML to make them readable for a parser. The parser interprets the markup elements specified in the XHTML language definitions and reproduces the content of these elements in a specific way.
The user ultimately sees what is contained in these elements and not the way in which the elements are noted or structured. The latter is called XHTML source code and can be edited with different text editors, for example, with a WYSIWYG editor. The notation separates the content and the layout. The content is enclosed by the elements. How this content is displayed is determined by the elements and only displayed by the browser.
Before an XHTML document can be created, you have to choose a Document Type Definition. There are three types, each with certain advantages and disadvantages, transitional, strict, and frameset. At the same time, the language version must be specified, such as XHTML 1.0 or 2.0. The basic framework of an XHTML file must conform to the rules exactly, otherwise it is not WFF (well-formed formula), which is valid source code that meets the requirements of language and document definitions and can be read by a browser.
Important differences between XHTML and HTML are, for example, the XML declaration, the document type definition, it is in lowercase, the exact compliance with the basic framework, and the fact that every open element must be closed again. If one of these rules is not adhered to in XHTML, the browser cannot display the document, which it probably still can with HTML.
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>An XHTML document</title> </head> <body> < h1 >Headline of the first order< /h1 > < p >A paragraph with any text content< /p > < h2 >Secondary heading< /h2 > < p >Another paragraph with any text content< /p > </body> </html>
When creating websites with XHTML, it is important to adhere to the rules as mentioned above. Valid source code then ensures that these XHTML documents can be read not only in browsers, but also on mobile devices. Moreover, validity (validity) can have a positive effect on search engines, by avoiding invalid status codes. A correctly recorded source code thus has a certain level of transferability and is possibly also an indicator for the search engines. However, HTML5 has now replaced XHTML and it remains to be seen how much XHTML is still used at all and to what extent websites using XHTML will still be positively evaluated by search engines.