The foundation language for the Web and Web-based hand-held devices is the HyperText Markup Language (HTML). It is a set of conventions agreed upon to identify elements within a document. These conventions define key codes (tags) and rules for how the tags are used. Recognizing these conventions, a browser can display the page.
The early Web was little more than a series of interlinked documents where the tags defined structure. Styling was pretty much left up to the browser. As an example, a headline tagged <h1> indicates only that it is the main head. Fom there the browser determines the font, size, and alignment that will be used.
Designers, wanting greater control over how their content would display, began inventing clever hacks to implement their own styling with imported images and by making tables work like layout containers. By the turn of the 21st century, code for the Web was complicated, confusing, and error prone.
The World Wide Web Consortium (W3C) is the official “keeper” of the code. They determine when new features and capabilities are “blessed” (what is supported and what is still a work in process). The most widely used version of HTML (4.01) reached its maturity at the end of 1999. In January of the next year the W3C created an XML version of 4.01 naming it XHTML 1.0. The main difference between XHTML and HTML 4.01 is that the rules follow XML coding conventions. This means that, unlike the “old” HTML, all attributes must contain quote marks, and all elements must be closed. So while the following code is legitimate in HTML, it fails the XHTML guidelines.
<p><img src=myimage.jpg alt=Best Picture>
<p>The quick brown fox jumped over the lazy dog.
Instead, the code needs to be written as follows:
<p><img src="myimage.jpg" alt="Best Picture"/></p>
<p>The quick brown fox jumped over the lazy dog.</p>
To define the particular set of rules that will apply to a document, a Document Type Definition (DTD) is used. It defines the legal building blocks for an XML document. The DOCTYPE declaration at the top of an HTML file describes the particular DTD to be used by the browser.