Re: Clarification Requested: block tags vs. inline tags

On 5 Jul 2001, at 15:18, Reitzel, Charlie wrote:

> But, I agree w/ Steven, Tidy is generating essentially correct HTML. 

HTML Tidy is generating correct HTML but not optimal HTML.

Given incorrect HTML, my understanding is that Tidy should attempt to 
correct it in such a way as to reproduce (where possible) the behavior of 
the incorrect HTML on common browsers.  So given that the original 
structure:

  <td><a><center></center></a></td>

is invalid (anchor elements cannot contain block elements, i.e., <a> cannot 
contain <center>), Tidy corrects this to:

  <td><a></a><div></div></td>

where the <div>s plus CSS take the place of the <center>s.  This is 
correct, but a better translation, i.e., equally correct and closer to the 
original behavior, would be:

  <td><div><a></a></div></td>

or specifically:

  <td width="150">
    <div class="c1">
      <a href="Kasse.htm">
        <img ...>
      </a>
    </div>
  </td>

Note that the correction suggested by the original poster:

  <td><a><div></div></a></td>

is invalid.


> Would <span> be ok?

<span> would be syntactically correct, as it is an inline element, but then 
the CSS would be invalid (the class="c1" that Tidy generates includes a 
"text-align" property, and "text-align" applies only to block elements).

                                      -- Dave

Received on Thursday, 5 July 2001 17:01:08 UTC