Chapter 23. Tidying and Validating Your Documents

IN THIS CHAPTER

  • Tidying Your HTML Code

  • Validating Your Code

  • Additional Testing and Validation

Most of your documents will endure multiple rounds of editing before and after they are published. It is important to keep your code as tidy as possible so that you can easily read and change them in the future. Also, after creating your documents, it is important to test them to ensure that visitors to your site will not encounter any unforeseen problems. This chapter covers the basics of testing your code, including what tools are at your disposal.

Tidying Your HTML Code

One important step while developing HTML documents is to keep the code tidy. Tidy code is code that is kept orderly with logical line breaks and intelligent indentation. Although this may not seem like a crucial issue, it takes only small snippets of code to see the difference, as illustrated in Listings 23.1 and 23.2.

Example 23.1. Untidy code

<table border="1" rules="all"> <tr><td><img src="./images/JillHennessy.jpg" width="100px" height="150px" alt="Jill" /><br />Jill Hennessy</td><td>Jill is the founder of the Oasis of Tranquility and its executive officer. She oversees the business side of the spa and operates as its chief recruiting officer. Jill has degrees in business and cosmetology.</td></tr><tr><td><img src="./images/SandraBrown.jpg" width="100px" height="150px" alt="Sandra" /><br />Sandra Brown</td><td>Sandra is the co-founder of the Oasis and its operating officer. ...

Get HTML, XHTML, and CSS Bible, Fifth 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.