Appendix A. HTML Element Quick Reference

IN THIS APPENDIX

  • Element listings

  • Event attributes

  • Other common attributes

This appendix provides a reference to HTML 4.01 elements using 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 leave out closing tags or place <i> inside <a>. Attribute values must be quoted, and minimized attributes are disallowed, which leads to odd constructs such as <select multiple="multiple">. The more strict conventions will 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 (either with 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 ...

Get HTML, XHTML, and CSS Bible, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.