HTML and CSS Reference
In-Depth Information
Start tag
End tag
<h1 id="books"> A heading </h1>
Attribute (optional)
Figure 3-1. HTML element structure
To distinguish the end tag from the start tag, the end tag has a slash after the opening angle bracket (in the form
</element> ). For example, a simple HTML paragraph looks like Listing 3-11.
Listing 3-11. A Simple Paragraph in HTML
<p> A simple paragraph. </p>
The elements can provide the structure and meaning to web documents through the indication of coherent
sections such as headings, paragraphs, lists, tables, image embeddings, forms, and so on.
The default style sheet of the browser used to render the document determines the default appearance. However,
the default appearance can be arbitrarily overridden by external style sheets as will be discussed later when we look at
Cascading Style Sheets (CSS).
Two special tags in HTML are different from all the others. Comments can be added by the <!-- ... --> tag.
The document type can be defined by the <!DOCTYPE> tag (see the “Document Type Declaration” section later in the
The XHTML Syntax and Restrictions
The element and attribute sets of the HTML and XHTML languages largely overlap, and most HTML elements can
be used in the corresponding XHTML 1.0 flavor (HTML 4.01 Transitional elements in XHTML 1.0 Transitional, and
HTML 4.01 Strict elements in XHTML 1.0 Strict). However, some elements introduced in the XHTML specifications can
be applied in XHTML exclusively (compare the elements of the various markup language versions in Table 3-7 ). The
major difference between earlier HTML and XHTML versions is that XHTML is stricter than HTML and it is extensible
while HTML is not. 7 The difference between the HTML and XHTML vocabularies completely disappeared with the
introduction of the latest markup versions, HTML5 and XHTML5, since HTML5 has exactly the same elements and
attributes as XHTML5.
The difference between HTML and XHTML can be demonstrated by the fundamental requirements of XHTML.
In fact, these strict rules point out best practices for superior markup that can also be extended with semantic
annotations, and boosted to the desired level of web accessibility. By applying these rules, you can write web
documents that are backward- and forward-compatible at the same time.
7 Up to version 4.01. From HTML5, external vocabularies, such as SVG and MathML, can be used in HTML, too, as
you will see later.
Search WWH ::

Custom Search