Re: [html5] inline table

On Sun, Jan 29, 2012 at 11:49 PM, Benjamin Hawkes-Lewis
<bhawkeslewis@googlemail.com> wrote:
> On Mon, Jan 30, 2012 at 12:26 AM, Andrew Fedoniouk
> <news@terrainformatica.com> wrote:
>> I understand that HTML5 parsing model prohibits <table> and other by
>> default block elements to be contained inside text containers like <p>
>> and <span>.
>>
>> But what if I want to use table that has display:inline-table styling
>> inside <p> for example:
>> http://terrainformatica.com/w3/inline-table.htm
>>
>> Is use of <span> soup with display:inline-table & friends styling is
>> the only option for such cases?
>
> Can you give an example of real content with inline-block tables?
>
> What's your rationale for not using <div> instead of <p> here?
>
> Note how HTML5 defines what represents a "paragraph":
>
>    http://dev.w3.org/html5/spec/content-models.html#paragraphs
>

Not strictly display:inline-table but rather table/float:right:

<p>... some text ....
... results of our experiment are provided in the table <table
style="float:right">...</table> on the right.
... some other text ....</p>

I've seen such cases in reality.

Here is an example:
<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <style>
      p { border:1px solid; }
      span { color:green; background-color: orange; }
      table { float:right; }
    </style>
  </head>
<body>
<p>
  inline-table: <table border>
    <tr><td>1</td><td>2</td></tr>
  </table>
  text after
</span>
</p>
</body>
</html>

As you see table is misplaced.


Andrew Fedoniouk.

http://terrainformatica.com

Received on Tuesday, 31 January 2012 02:45:58 UTC