[csswg-drafts] [css-tables-3] Question about column width computation (#9829)

alexandergitter has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-tables-3] Question about column width computation ==
I'm trying to understand the width calculations of columns in a table with a specified width.

Looking at https://drafts.csswg.org/css-tables-3/#computing-column-measures, the calculation of the column width, based on cells with span 1, basically boils down to:

> The largest of:
> - the width specified for the column:
>   - the outer min-content width of its corresponding table-column [...]
>   - the outer min-content width of its corresponding table-column-group [...]
> [...]
> - the outer min-content width of each cell [...]

where `outer min-content` is defined in the section before, https://drafts.csswg.org/css-tables-3/#computing-cell-measures. They are defined as follows:

> - The outer min-content width of a table-cell is max(min-width, min-content width) adjusted by the cell intrinsic offsets.
> - The outer min-content width of a table-column or table-column-group is max(min-width, width). 

Reading this, it appears to me that (in this case) setting `width` on a `<td>` has no bearing on the calculated width of the corresponding column, whereas `min-width` does. For `<colgroup>` or `<col>` on the other hand, both `width` and `min-width` are taken into account.

I tried the following example in Firefox and Chrome:
```
<table border="1" style="width: 400px">
  <colgroup>
    <col>
    <col>
    <col style="width: 700px">
  </colgroup>

  <tr>    
    <td style="width: 700px">width</td>
    <td style="min-width: 700px">min-width</td>
    <td>col width</td>
  </tr>   
</table>
```

and sure enough, `width` in the first cell/column has no impact and the cell with a `min-width` stretches its column (and the table) by its minimum width. The last column however does not grow to the specified col width - from the spec, I would expect that it does. What am I missing? Did I misinterpret the "table-column or table-column-group is max(min-width, width)" part?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9829 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 21 January 2024 21:15:27 UTC