XHTML 1.1 represents a modern reformulation of HTML as an XML application, allowing extensions to the language to be more easily defined and implemented. This appendix provides a quick reference to the elements and attributes of XHTML 1.1 that you are most likely to see and use, as well as the style properties that CSS 2 comprises. For the complete specifications, visit http://www.w3.org/.
To make the information readily accessible, this appendix organizes HTML elements by their function in the following order:
• Structure
• Text phrases and paragraphs
• Text formatting elements
• Lists
• Links
• Tables
• Embedded content
• Style
• Forms
• Scripts
The elements are listed alphabetically within each section, and the following information is presented:
• Usage–Gives a general description of the element.
• Start/End Tag–Indicates whether these tags are required, optional, or illegal.
• Attributes–Lists the attributes of the element with a short description of their effect. Any attributes that are used for mouse control or to invoke client-side scripting are not indicated here; please see the full specification at the W3C web site for those action-oriented attributes.
• Empty–Indicates whether the element can be empty.
• Notes–Relates any special considerations for using the element.
The CSS style properties follow a similar arrangement except that they are listed with acceptable values, as opposed to attributes.
XHTML 1.1 includes several fundamental attributes that apply to a significant number of elements. These are referred to within each element listing as core
, i18n
, and events
. These attribute groups are covered in detail after all the XHTML elements are presented. There you’ll find the specific attributes associated with each of these attribute groups.
XHTML relies on several elements to provide structure to a document (as opposed to structuring the text within) as well as to provide information that is used by the browser or search engines.
You might run across HTML web pages that use the <div>
element with an attribute named align
. This attribute was removed in XHTML and HTML 5, with the new approach to alignment involving the text-align
CSS style property. This style property is covered later in this appendix.
The profile
attribute is not allowed in HTML 5.
The scheme
attribute is not allowed in HTML 5.
Text phrases (or blocks) can be structured to suit a specific purpose, such as creating a paragraph. This should not be confused with modifying the formatting of the text.
General text characteristics (such as the size, weight, and style) can be modified using these elements, but the preferred approach is to use CSS style properties. Later in the appendix, you’ll find a complete reference for these properties, which provide an incredible amount of control over text formatting.
This element has been removed in HTML 5 because its effect is purely presentational and thus better handled by CSS.
This element has been removed in HTML 5 because its effect is purely presentational and thus better handled by CSS.
You can organize text into a more structured outline by creating lists. Lists can be nested.
Hyperlinking is fundamental to XHTML. These elements enable you to link to other documents, other locations within a document, or external files.
The charset
, rev
, and
target attributes are not allowed in HTML 5.
Tables are meant to display data in a tabular format. Prior to XHTML, tables were widely used for page layout purposes, but with the advent of style sheets, this is officially discouraged by the W3C as well as the authors of this book.
The width
, align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The width
, align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The width
, align
, border
, frame
, rules
, cellspacing
, cellpadding
, and summary
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The axis
, align
, char
, charoff
, valign
, and scope
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The axis
, axes
, align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The align
, char
, charoff
, and valign
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
Also called inclusions, embedded content applies to images, imagemaps, Java applets, Flash animations, and other multimedia or programmed content that is placed in a Web page to provide additional functionality.
The hspace
and vspace
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
The hspace
and vspace
attributes have been removed in HTML 5 because their effects are purely presentational and thus better handled by CSS.
Style sheets (both inline and external) are incorporated into an HTML document through the use of the <style>
element
Forms create an interface for the user to select options, enter information, and return data to the Web server for processing.
Scripts make it possible to process data and perform other dynamic events. Scripts are included in web pages thanks to the <script>
element, which also identifies the specific scripting language being used (JavaScript, VBScript, and so on.).
The following six attributes are abbreviated as core
in the preceding sections:
• id="
id
"
–A global identifier.
• class="
styleclasses
"
–A list of classes separated by spaces.
• style="
styles
"
–Style information.
• title="
title
"
–Provides more information for a specific element (as opposed to the <title>
element, which titles the entire Web page).
• accesskey="
shortcut
"
–Sets the keyboard shortcut used to access an element.
• tabindex="
taborder
"
–Sets the tab order of an element.
The following two attributes for internationalization are abbreviated as i18n
in the preceding sections:
• lang="
lang
"
–The language identifier.
• dir="
textdir
"
–The text direction (ltr
, rtl
).
The following intrinsic events are abbreviated events
. For more information on their application in specific elements, see the W3C specification:
• onclick="
eventcode
"
–A pointing device (such as a mouse) was single-clicked.
• ondblclick="
eventcode
"
–A pointing device (such as a mouse) was double-clicked.
• onmousedown="
eventcode
"
–A mouse button was clicked and held down.
• onmouseup="
eventcode
"
–A mouse button that was clicked and held down was released.
• onmouseover="
eventcode
"
–A mouse moved the cursor over an object.
• onmousemove="
eventcode
"
–The mouse was moved.
• onmouseout="
eventcode
"
–A mouse moved the cursor off an object.
• onkeypress="
eventcode
"
–A key was pressed and released.
• onkeydown="
eventcode
"
–A key was pressed and held down.
• onkeyup="
eventcode
"
–A key that was pressed has been released.
Quite a few CSS style rules rely on dimensional properties in one form or another. It would be difficult to size elements with them.
The heart of CSS styling lies in the text and style properties, which give you an incredible amount of control over the appearance of Web page text.
There are several CSS style properties that can be used to alter the backgrounds of pages and individual elements on pages.
Every block element has a border that can be styled. Although you can certainly leave borders invisible, there are several styles that can be applied to element borders.
Margins allow you to add a bit of spacing around the outer edge of an element, outside of the element’s border.
Padding allows you to add space around an element, inside of the element’s border.
The layout and display properties in CSS play an extremely important role in determining how elements are laid out and arranged on the page.
You might not have realized how much flexibility there is when it comes to the styling of lists via CSS. Several CSS styles apply to lists and the list-item markers (or bullets) within the lists.
There are a few advanced table properties that enable you to fine-tune the manner in which tables are rendered and displayed.