W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2001

Re: Clarification Requested: block tags vs. inline tags

From: J. David Bryan <jdbryan@acm.org>
Date: Thu, 5 Jul 2001 17:01:04 -0400
Message-Id: <200107052101.f65L16j24035@mail.bcpl.net>
To: HTML Tidy List <html-tidy@w3.org>
CC: tidy-develop@lists.sourceforge.net
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:46 GMT