Re: CSS3 Genrated content, comments/questions

>     <table>
>       <tr><td>First</td><td>Second</td></tr>
>       Third
>       <tr><td>Fourth</td></tr>
>     </table>

Given this HTML, a typical HTML parser will do some error-recovery because a
text node is not allowed as a child of the table node in HTML.  Typically, the
parser will create the following DOM tree:

HTML
 \_BODY
    |\_#text ("Third")
    |
    \__TABLE
       \_.....

That is, by the time CSS sees the DOM tree, the text is NOT a child of that
table.  The case Ian is talking about is when there is a text node in the DOM
and its parent has display:table.  To see how current browsers handle this
case, you need to put it there via DOM manipulation, typically.

Alternately, you can do something like:

<div style="display: table">
  <div style="display: table-row">
    <div style="display: table-cell">First</div>
    <div style="display: table-cell">Second</div>
  </div>
  Third
  <div style="display: table-row">
    <div style="display: table-cell">Fourth</div>
  </div>
</div>

which will create the right CSS box model for testing this, assuming the
browser supports those display values, of course.

Boris
-- 
Washington [D.C.] is a city of Southern efficiency and
Northern charm.
                       -- John F. Kennedy

Received on Tuesday, 16 September 2003 10:37:15 UTC