Skip to content

[css-tables][css-sizing] What sizing keywords allow fixed table mode? #10937

Open
@Loirooriol

Description

@Loirooriol

Situation

https://drafts.csswg.org/css-tables/#table-layout-property says

A table-root is said to be laid out in fixed mode whenever the computed value of the table-layout property is equal to fixed, and the specified width of the table root is either a <length-percentage>, min-content or fit-content.

This is the logic that browsers use for the inline size:

So we have a mismatch of keywords that accept fixed table layout:

Value Spec WebKit Gecko Blink
<length-percentage>
auto
min-content (*)
max-content (*)
fit-content (*)
<fit-content()> ❌︎ ✅︎
contain ❌︎ ✅︎ ✅︎
stretch ❌︎ ✅︎
-webkit-fill-available ❌︎
-moz-available ❌︎ ❌︎ ✅︎
intrinsic ❌︎ ✅︎ ✅︎
min-intrinsic ❌︎ ✅︎ ✅︎

<calc-size()> should just behave as its basis.

(*) including -webkit- and -moz- prefixes.
✅: Supports the value (at least partially), and allows fixed table layout
✅︎: Doesn't support the value, but it would allow fixed table layout
❌: Supports the value (at least partially), and doesn't allows fixed table layout
❌︎: Doesn't support the value, but it wouldn't allow fixed table layout

Example

<!DOCTYPE html>
<div style="width: 0">
  <table style="table-layout: fixed; width: -webkit-fill-available" border>
    <tr><td>lorem ipsum</td></tr>
  </table>
</div>

On Firefox (with layout.css.webkit-fill-available.enabled = true) and Blink the table ignores the contents and is almost 0px wide, while on WebKit it's wider according to the text.

Changes

I think that <fit-content()> should allow fixed table layout, just like fit-content and min-content.

And maybe stretch should too, to match 100%? Also, -webkit-fill-available/-moz-available is kinda the same thing, and it allows fixed table layout on 2/3 of the major browsers.

Nobody implements contain, but we should also decide what to do with it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Friday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions