Tidy 6

From Htmlpedia
Jump to: navigation, search

Tidy: missing </...>

Cause:

A closing tag is missing. Most HTML tags need to be closed, though the exact set of tags varies according to which DTD you're using. For example, in HTML 4.01, the <img> tag does not need to be closed. In XHTML 1.0 and higher, however, it needs to be closed with a trailing slash, as in <img />. Such tags are called "empty elements".

Example 1 - Missing Closure (Normal)

Bad<head><title>hello</head>
Good<head><title>hello</title></head>

Example 2 - Missing Closure (Empty Elements)

Bad<img src="whatever.jpg" width="20" height="400" alt="Whatever">
Good<img src="whatever.jpg" width="20" height="400" alt="Whatever" />

Solution:

Add the closing tag. Usually the is the same as the opening tag. As noted above, however, XHTML requires some tags to be closed with a trailing slash. According to XHTML 1.0 Transitional DTD, the following tags are "empty":

  • <base />
  • <meta />
  • <link />
  • <hr />
  • <br />
  • <basefont />
  • <param />
  • <img />
  • <area />
  • <input />
  • <isindex />
  • <col />


References: