Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a table cell have a containing block?

Tags:

html

css

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>
like image 951
Zhen Zhang Avatar asked Aug 31 '14 09:08

Zhen Zhang


People also ask

What is a containing block?

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 .

What defines a table cell?

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.

Which tag is used for table cell?

The <tr> HTML element defines a row of cells in a table.

What is table cell in HTML?

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)


1 Answers

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.

like image 192
BoltClock Avatar answered Nov 03 '22 09:11

BoltClock