Tips on Good HTML Style
This section offers some guidelines for writing “good” HTML—code that will be supported by a wide variety of browsers, handled easily by applications expecting correct HTML, and extensible to emerging technologies built on the current HTML specification.
Follow HTML syntax as described by the current available W3C specification. Writing HTML “correctly” may take extra effort, but it ensures that your document displays the way you intend it to on the greatest number of browsers. Browsers vary in how strictly they parse HTML. For instance, if you omit a closing
</table>tag, some versions of Internet Explorer display the contents of the table just fine, while Netscape Navigator leaves that portion of your web page completely blank.The Opera browser is particularly stringent. Simple slips or shortcuts that slide right by Navigator or Internet Explorer may cause your whole web page to self-destruct. If you are careful in the way you write your HTML (minding your
<p>s and<q>s!), you will have more success on more browsers.Validate your HTML. To be absolutely sure about how you’re doing, you should run your HTML code through one of the many available online HTML validation services, such as the ones at the W3C (http://validator.w3.org), NetMechanic (http://www.netmechanic.com), Web Design Group (http://www.htmlhelp.com), and Doctor HTML (http://www2.imagiware.com/RxHTML/).
Follow code-writing conventions to make your HTML document easier to read. Although ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access