CHAPTER 3 WEB VOCABULARIES In HTML, empty elements appeared like this: In XHTML, empty elements can either appear with an immediate opening and closing tag, such as or in the short form, such as In the short form, you add a forward slash (/) before the closing angle bracket (>). This tells the XML or XHTML parser that the element is empty. Although both forms are legal XHTML, very old browsers have problems reading opening and closing tags for elements that are empty. It s much better to use the short form for empty elements. These browsers also may have difficulty with the forward slash character, so, if you re targeting them, it s also good practice to add a space before the character ( ). Attributes In addition to using the proper case for attribute names, you also need to make sure that you write them correctly. In HTML, you could write attribute values without quotation marks. For example, the following was legal in HTML:
HTML also allowed you to minimize attributes: Neither of these options is acceptable in XHTML. All attributes must have a value, even if it s blank, and you must enclose all values in matching quotation marks:
In the preceding
element, you add quotation marks around the attribute value 4. In the