According to http://www.w3.org/TR/CSS2/visudet.html, some elements can have a "containing block". Does a table cell td
have a containing block, like tr
?
e.g.
<div>
<table>
<tr>
<td>hi</td>
</tr>
</table>
</div>
For elements (other than the root) that are set to static or relative , the containing block is the content edge of the nearest block-level, table cell, or inline-block ancestor. For absolutely placed elements, the containing block is the nearest ancestor element that has a position other than static .
A table cell is one grouping within a chart table used for storing information or data. Cells are grouped horizontally (rows of cells) and vertically (columns of cells). Each cell contains information relating to the combination of the row and column headings it is collinear with.
The <tr> HTML element defines a row of cells in a table.
The <td> tag defines a standard data cell in an HTML table. An HTML table has two kinds of cells: Header cells - contains header information (created with the <th> element) Data cells - contains data (created with the <td> element)
The section linked to above says:
2. For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the content edge of the nearest block container ancestor box.
Now, a table-row box is not a block container box because it only contains table-cell boxes, which are not block-level boxes. Neither is a table a block container box because it can only contain other types of boxes, none of which are block-level (e.g. row groups).
Looking at the section on tables, the only references to a containing block in that section refer to the containing block of a table, not a table-cell.
Based on this, it's probably safe to assume that the containing block of a table-cell box or any other internal table box is the same as the containing block of the table in which it resides (which, in your example, is the div
). A more conservative reader might prefer to assume that the containing block of any internal table box is undefined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With