O'Reilly logo

HTML, XHTML, and CSS Bible, Fifth Edition by Steven M. Schafer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. XHTML Element Quick Reference

IN THIS APPENDIX

  • Element Listings

  • Event Attributes

  • Other Common Attributes

This appendix provides a reference to XHTML 1.1 markup conventions and standards. As a result of its XML heritage, XHTML is much less forgiving than HTML has historically been (or, perhaps more accurately, than HTML browsers have been). You cannot omit closing tags or place an italic (i) element inside an anchor (a) element. Attribute values must be quoted, and minimized attributes are disallowed, which leads to odd constructs such as <select multiple="multiple">. The more strict conventions help ensure that your code is more standards-compliant and forward-looking.

Here are some tips to keep in mind when working with XHTML:

  • XHTML documents must be well-formed (closing tags required, no overlapping tags allowed).

  • Empty elements can be both opened and closed with one tag: <img src="foo"/>.

  • All elements and tags must be in lowercase.

  • Attribute values must be quoted (with either single or double quotes).

  • Attributes cannot be minimized—that is, all attributes must have values. For example, the textarea element supports a readonly attribute. In HTML, the attribute had to be present only in the element, such as <textarea readonly>. In XHTML, however, the readonly attribute must have a value. When a value is not applicable, the name of the attribute is generally used, such as <textarea readonly="readonly">.

In the element listings that follow, the location within a document in which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required