Closed Bug 308403 Opened 19 years ago Closed 7 months ago

Constraining table cells with max-height/max-width does not work

Categories

(Core :: Layout: Tables, defect)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

(Keywords: css2, testcase, Whiteboard: [reflow-refactor])

Attachments

(2 files)

(spawned off from bug 307866) Constraining table cells with max-height/max-width does not work
Attached file Testcase: max-height
Attached file Testcase: max-width
According to the CSS2 spec (http://www.w3.org/TR/REC-CSS2/visudet.html), "max-height", "min-height", "max-width", and "min-width" apply to "all elements except non-replaced inline elements and table elements." Now comes the fun part: what is a "table element"? The CSS2 table spec (http://www.w3.org/TR/REC-CSS2/tables.html), section 17.2.1, paragraph 1 mentions the phrase "table element" in reference to *any* element styled with a "display" of any of the table values (table, table-row, table-cell, etc.). I don't know that my reading is correct, but if it is, HTML's default stylesheet sets TD elements to be "display:table-cell", so they would theoretically count as "table elements," and, thus, would not have a "max-height" property. By default, tables get their height from their TRs, which in turn get their height from the TDs, which then get their height from the content (IOW, all "height:auto"). I think you can *simulate* what you want by setting the TD in question to have "height:100%", then create a DIV within the TD with "height:100%; max-height:[whatever]; overflow:auto;" for your content. The content is constrained by the DIV, and the DIV sets the height of the TD.
You're reading an old spec, CSS 2.1 is what we want to implement, it says: http://www.w3.org/TR/CSS21/visudet.html#min-max-widths "'min-width' and 'max-width' .... Applies to: all elements but non-replaced inline elements, table rows, and row groups" http://www.w3.org/TR/CSS21/visudet.html#min-max-heights "'min-height' and 'max-height' ... Applies to: all elements but non-replaced inline elements, table columns, and column groups" which is the same as for 'width'/'height' respectively BTW. (CSS3 box model also includes rows/cols/groups, but I would not rely to much on that working draft at this point). http://www.w3.org/TR/2002/WD-css3-box-20021024/#the-min-width http://www.w3.org/TR/2002/WD-css3-box-20021024/#the-width
Whiteboard: [reflow-refactor]
the css 3 box currently does not differ from CSS 2.1 http://www.w3.org/TR/css3-box/#min-max
Severity: normal → S3

These days, as far as I can tell, our rendering on the attached testcases is 100% consistent with Chromium/WebKit. i.e. in the attached testcases, I think we all ignore max-height on table cells; and we agree on ignoring max-width in some specific cases and honoring it in others.

Given this 100%-interop on this bug's testcases and the status of table-layout as a sort of legacy feature with tons of built-up content out there in the wild, we're probably compat-constrained in our ability to further-change behavior on this, in pursuit of theoretical-purity here. Hence, I'm closing this broader "max-width / max-height" bug as WONTFIX.

If there are specific cases where we're not interoperable, OR where we're interoperable but there's another clearly-better behavior and we can get buy-in from other browsers (so as not to create compat pain for ourselves), then we can track those in their own specific bugs.

Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: