CSS Contain says
if the element is an internal table element, size containment has no effect.
Various times I wanted to prevent the contents of a specific cell from enlarging the row. Usually, my solution is adding an abspos wrapper inside the cell.
I believe contain: size would do exactly what I want in a less hacky way, but for some reason you excluded it from applying to all internal table elements. I don't care about rows and such, but elements with display: table-cell don't have a layout-internal inner display type, so I think contain: size should apply.
That would allow table-cells to violate the "nothing is allowed to ever overflow" rule they generally operate under.
That would allow table-cells to violate the "nothing is allowed to ever overflow" rule they generally operate under.
Yes. But last time I checked, various browsers violated this rule in situations whose behavior was undefined according to CSS 2.1. Not sure if CSS Tables 3 specifies another behavior, I haven't read it whole.
There are indeed a few edge cases where the content might overflow its cell.
There is however no interest from Microsoft in allowing devs to optimize/tweak table layouts; we want to encourage developers to use display:grid instead (and benefit from the new, fast algorithm we have there instead of trying to fiddle with the performance of tables).
As you mentioned, there is already a functionally-equivalent solution using position:absolute, so we are not impacting author's ability to do things by not adding support for table-cells in layout containment.
@FremyCompany, does that mean that Microsoft is about to implement the subgrid feature (or, at least, the display:contents workaround)? Currently, the table layout has the unique ability of true vertical connection between elements from different row wrappers. Getting the same layout with Grid currently requires either flattening the DOM to one level or using display:contents workaround that isn't supported enough yet.
@SelenIT It just means that were are thinking forward to the future ;-) We will eventually ship subgrid, and any time we spend working on adding new features to tables is time we don't have to get to the point where we can start working on subgrid.
As I mentioned, there is a workaround for the time being that developers are well aware of, I don't see a need to complexify layout containment. We currently do not support layout containment either fwiw.
@FremyCompany thanks for the clarification!
It would be still great if Microsoft implements display: contents (which is already shipped in Firefox and implemented in Chrome behind the flag), it would make Grid suitable for much more cases than without it!
@Loirooriol : Although it initially sounds like size containment could be useful on table cells, I agree with @FremyCompany and @tabatkins : this isn't something we can easily do. The way it would cause the table cell to overflow is undefined, and there's pretty much no willingness from browsers to try and define it, much less implement it. This was discussed before, and we concluded against it already (I was the one asking for it last time).
The conclusion of that discussion can be found here on IRC, and the broader issue of what contain does on table parts was tracked as Issue 14 in the DoC preparing for CR.
Unless you think there is anything new to be said about this topic, I'm going to close it with no change, as we have already resolved on the same thing with the same (as far as I can tell) arguments.
No, there isn't anything new to add other than that this would be a nice workaround to the madness of table layout, which does not obey the height property as one would expect.
which does not obey the height property as one would expect
This layout doesn't use any property as you would expect ;-)
Solving the madness of table layout, while tempting, is not a goal of css-contain :) And since it wouldn't magically solve it, but instead force us to define how that works (and to implement whatever we come up with), I'd rather not got down that rabbit hole.
Not to say I don't sympathize with wanting the feature, 'cause I totally do, but last time I tried to talk browser vendors into that, they made it quite clear that they weren't going there.
Closing as wontfix.
If you ever get browser vendors enthusiastic about adding features to table layout, maybe we can revisit :)
Marking this as WONTFIX by csswg resolution because of the previous resolution on the same topic: https://logs.csswg.org/irc.w3.org/css/2017-04-21/#e800809
@Loirooriol, for process reasons, I'd appreciate if you could let us know if you're willing to live with this decision.
@frivoal Yes.
Most helpful comment
This layout doesn't use any property as you would expect ;-)