After introducing you to how to use JavaScript and CSS correctly in XHTML, W3CGroup continues to bring you 16 guidelines for XHTML and HTML compatibility!
1. Avoid declaring the page as XML type. The page uses UTF-8 or UTF-16 character set.
2. Add a slash / before the end character > of empty element tags (tags that cannot be used to contain content), such as: <br />, <hr />, etc.
3. When the content of a non-empty element (this tag is used to contain content, such as a title, paragraph) is empty, give it a blank character instead of using the ending method like an empty element, such as: when an element has no content Please write the P tag: <p> </p> instead of <p />.
4. When <, &, ]]> or two consecutive horizontal bars -- appear in your style and scripts content, please use external files to import them.
5. Avoid line breaks or multiple spaces in element attribute values.
6. Do not include more than one isindex element in the head part of the document (it is best not to use it). This element is not recommended.
isindex: Causes the browser to display a dialog box prompting the user to enter a single line of text.
In HTML 4, this element is deprecated in favor of the INPUT element. The tagName property of isIndex will return input.
This element is a block element and this element requires a closing tag.
The following example uses the ISINDEX element to override the default prompt:
<isindex prompt="Enter the index keyword to search" />
7. When you want to specify language for an element, please use the lang and xml:lang attributes. The value of xml:lang has higher priority.
8. Please use the id attribute as the element identifier and avoid using the name attribute. Especially on these elements, it is not recommended to use the name attribute as their identifier: a, applet, form, frame, iframe, img, map.