XHTML (Extensible Hypertext Markup Language) is a markup language for creating Web pages.
A key issue when using XHTML is the separation of the presentation of a document (i.e., the document's appearance when rendered by a browser) from the structure of the information in the document.
In XHTML, text is marked up with elements, delimited by tags that are names contained in pairs of angle brackets. Some elements may contain additional markup called attributes, which provide additional information about the element.
A machine that runs specialized piece of software called a Web server stores XHTML documents.
XHTML documents that are syntactically correct are guaranteed to render properly. XHTML documents that contain syntax errors might not display properly.
Every XHTML document contains a start <html> tag and an end </html> tag.
Comments in XHTML always begin with <!-- and end with -->. The browser ignores all text inside a comment.
Every XHTML document contains a head element, which generally contains information, such as a title, and a body element, which contains the page content. Information in the head element generally is not rendered in the display window but could be made available to the user through other means.
The title element names a Web page. The title usually appears in the colored bar (called the title bar) at the top of the browser window and also appears as the text identifying a page when users add your page to their list of Favorites or Bookmarks.
The body of an XHTML document is the area in which the document's content is placed. The content may include text and tags.
All text placed between the <p> and </p> tags form one paragraph.
XHTML provides six headers (h1 through h6) for specifying the relative importance of information. Header element H1 is considered the most significant header and is rendered in a larger font than the other five headers. Each successive header element (i.e., h2, h3, etc.) is rendered in a smaller font.
Web browsers typically underline text hyperlinks and color them blue by default.
The <strong> tag usually causes a browser to render text in a bold font.
Users can insert links with the a (anchor) element. The most important attribute for the a element is href, which specifies the resource (e.g., page, file, e-mail address) being linked.
Anchors can link to an e-mail address using a mailto: URL. When someone clicks this type of anchored link, most browsers launch the default e-mail program (e.g., Outlook Express) to initiate e-mail messages to the linked addresses.
The img element's src attribute specifies an image's location. Optional attributes width and height specify the image width and height, respectively. Images are measured in pixels ("picture elements"), which represent dots of color on the screen.
The alt attribute makes Web pages more accessible to users with disabilities, especially those with vision impairments.
Some XHTML elements are empty elements, contain only attributes and do not mark up text. Empty elements (e.g., img) must be terminated, either by using the forward slash character (/) or by explicitly writing an end tag.
The br element causes most browsers to render a line break. Any markup or text following a br element is rendered on the next line.
XHTML provides special characters or entity references (in the form &code;) for representing characters that cannot be marked up.
Most browsers render a horizontal rule, indicated by the <hr /> tag, as a horizontal line. The HR element also inserts a line break above and below the horizontal line.
The unordered list element ul creates a list in which each item in the list begins with a bullet symbol (called a disc). Each entry in an unordered list is an li (list item) element. Most Web browsers render these elements with a line break and a bullet symbol at the beginning of the line.
Lists may be nested to represent hierarchical data relationships.
Attribute type specifies the sequence type (i.e., the set of numbers or letters used in the ordered list).
XHTML tables mark up tabular data and are one of the most frequently used features in XHTML.
The table element defines an XHTML table. Attribute border specifies the table's border width, in pixels. Tables without borders set this attribute to "0".
Element summary summarizes the table's contents and is used by speech devices to make the table more accessible to users with visual impairments.
Element caption describe's the table's content. The text inside the <caption> tag is rendered above the table in most browsers.
A table can be split into three distinct sections: head (thead), body (tbody) and foot (tfoot). The head section contains information such as table titles and column headers. The table body contains the primary table data. The table foot contains information such as footnotes.
Element TR, or table row, defines individual table rows. Element th defines a header cell. Text in th elements usually is centered and displayed in bold by most browsers. This element can be present in any section of the table.
Data within a row are defined with TD, or table data, elements.
Element colgroup groups and formats columns. Each col element can format any number of columns (specified with the span attribute).
The document author has the ability to merge data cells with the rowspan and colspan attributes. The values assigned to these attributes specify the number of rows or columns occupied by the cell. These attributes can be placed inside any data-cell tag.
XHTML provides forms for collecting information from users. Forms contain visual components, such as buttons that users click. Forms may also contain non-visual components, called hidden inputs, which are used to store any data, such as e-mail addresses and XHTML document file names used for linking.
A form begins with the form element. Attribute method specifies how the form's data is sent to the Web server.
The "text" input inserts a text box into the form. Text boxes allow the user to input data.
The input element's size attribute specifies the number of characters visible in the input element. Optional attribute maxlength limits the number of characters input into a text box.
The "submit" input submits the data entered in the form to the Web server for processing. Most Web browsers create a button that submits the form data when clicked. The "reset" input allows a user to reset all form elements to their default values.
The textarea element inserts a multiline text box, called a text area, into a form. The number of rows in the text area is specified with the rows attribute and the number of columns (i.e., characters) is specified with the cols attribute.
The "password" input inserts a password box into a form. A password box allows users to enter sensitive information, such as credit-card numbers and passwords, by "masking" the information input with another character. Asterisks are the masking character used for password boxes. The actual value input is sent to the Web server, not the asterisks that mask the input.
The checkbox input allows the user to make a selection. When the checkbox is selected, a check mark appears in the checkbox. Otherwise, the checkbox is empty. Checkboxes can be used individually and in groups. Checkboxes that are part of the same group have the same name.
A radio button is similar in function and use to a checkbox, except that only one radio button in a group can be selected at any time. All radio buttons in a group have the same name attribute value and have different attribute values.
The select input provides a drop-down list of items. The name attribute identifies the drop-down list. The option element adds items to the drop-down list. The selected attribute, like the checked attribute for radio buttons and checkboxes, specifies which list item is displayed initially.