Closed Bug 307866 Opened 19 years ago Closed 25 days ago

min-width/min-height/max-width/max-height does not work for table elements


(Core :: Layout: Tables, defect)






(Reporter: giampaolo, Unassigned)




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


(6 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4

See the example here:
the <tbody> tag should display scrollbars in the table thanks to the following
style sheet:
<tbody style="max-height:110px;overflow:auto">
in Firefox 1.5 beta1 this seems not working, as happens in Firefox 1.0.6

Reproducible: Always

Steps to Reproduce:
Create a long table with max-height/overflow:auto style sheet properties in the
<tbody> tag. The max height value should be less height than the table height.
Actual Results:  
Scrollbars don't appears

Expected Results:  
Show scrollbars

I've upgraded from firefox 1.0.6 to firefox 1.5 beta
Attached file Example file (obsolete) —
I found the CSS2 specification doesn't allow the max-height property in table cells:
So I guess this is not really a bug.
Severity: normal → minor
In the latest CSS 2.1 working draft, max-height is said to apply to "all 
elements but non-replaced inline elements, table columns, and column groups", so 
it should affect TBODY. 
Component: General → Layout: Tables
Product: Firefox → Core
QA Contact: general → layout.tables
Version: unspecified → Trunk
INVALID per comments 2 and 3.
Closed: 19 years ago
Resolution: --- → INVALID
You misread comment 3.
Resolution: INVALID → ---
Attached file TR min-height
Attached file TBODY max-height
Attachment #195521 - Attachment is obsolete: true
Assignee: nobody → mats.palmgren
Severity: minor → normal
Ever confirmed: true
Keywords: css2, testcase
OS: Windows XP → All
Hardware: PC → All
Summary: CSS: max-height in tbody doesn't work in 1.5 beta1 → min-width/min-height/max-width/max-height does not work for table elements
Attached patch Patch rev. 1Splinter Review
Attachment #195979 - Flags: superreview?(dbaron)
Attachment #195979 - Flags: review?(bernd_mozilla)
Blocks: 308403
Comment on attachment 195979 [details] [diff] [review]
Patch rev. 1

I have spawned off max-height/max-width for table cells to bug 308403,
which this patch does not address (other than setting up a correct
reflow state).
*** Bug 227650 has been marked as a duplicate of this bug. ***
Mats, sorry for the delay but its high on my priority list now.

+        if (eStyleUnit_Auto == heightUnit) {
+          mComputedHeight = (mComputedMinHeight == 0) ? NS_AUTOHEIGHT :
+        } else {

Could you please convince me that this is the right thing to do.

If a auto height table element has a min height it gets a computed height?

Wouldnt that break for standards mode the pct to auto conversion for children of
such a element?

nsStyleCoord nsTableColFrame::GetStyleWidth() const

I have big doubts that the changes are correct, while usually fixed widths are
the upper limits, with the patch a specified min width on a column turns the
column into a column with a fixed width, I would rather expect that a specified
min width influences rather the MEW than changes a col type.

Comment on attachment 195979 [details] [diff] [review]
Patch rev. 1

The changes to BasicTableLayoutStrategy are wrong. The min-width should update
the max-width is an additional constraint which should be added between MIN_PRO
and FINAL. The new constraint should take part in the balancing.
My proposal is to split these widths for colspans just by dividing trough the
real cols that it covers.
Attachment #195979 - Flags: review?(bernd_mozilla) → review-
Blocks: 311639
Out of curiousity... has this bug been forgotten?
No point working on this until reflow branch lands, since that rewrites pretty much all of BasicTableLayoutStrategy.
Whiteboard: [reflow-refactor]
2.0 is out, any news on when the reflow branch will land and when this will be fixed?
Kelly, what 2.0 is doing is completely unrelated to the reflow branch.  The current trunk plan is to stabilize the existing cairo and Cocoa widget work, then ship an alpha of Gecko 1.9 sometime in early to mid November, with any luck, then land the reflow branch on the trunk.  After that, this bug should be revisited.

You can keep track of the current state of reflow branch via and
Now that the reflow branch has landed, will this bug be revisited?
At some point, sure.  There are 80-some open bugs (including this one) that are flagged as needing someone to look at them after the branch lands, so...  ;)
Most of the patch is obsolete due to the reflow branch landing.
This is still alive.

Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9b3pre) Gecko/2008010605 Minefield/3.0b3pre
It's weird, but this bug still seems to be present in FF3.5
I still do not see the expected behaviour on my divs containing tables like FF1.x did...
Please address this issue again. It's really annoying..
For me, I was setting up a table I wanted to center and set the max-width.  It worked--but only if I used inline styles.  If I use a class, "max-width:792px;" is treated as "width:792px;" and the table is left justified.  To be fair, IE appears to be doing the same.
This bug is about table _internal_ elements, not <table>s.  We don't do anything differently for inline style vs class styling, so it sounds like you just had a mistake in your class styling somewhere.  Please file a separate bug if you think there was a Gecko issue on your testcase, and attach your testcase to that bug.

Any news on this bug, this is still current en very much annoying. Any idea on when it will be fixed, it seems to take a long time...
Danilo, comments 30 and 31 have nothing to do with this bug.
I do not understand why it takes so long to fix "min-height" because the "height" property is interpreted as minimum height on tables anyway (it's like an alias).

Today, only Firefox does not support this property on table, even with IE 11 it works fine. It's surprising to see a basic layout property not working only on firefox and to do a workaround only for this browser.

I thought maybe nobody reported it, but since 2005 this bug is know. I don't know what is happening, maybe this bug should be splitted in 4 differents bugs (one for each properties).
No longer blocks: 311639
This page is broken in Firefox because of this:
I just ran into this problem also, pretty annoying to see my site broken in FF and have to spend extra time having to fix it for a specific browser.
There's duplicates of this bug here (or this is a duplicate of one of them :D) : 
bug 720669
bug 975632
bug 308403
bug 434230
(found with
That's not a great search, because....

> bug 720669

Is about an element _inside_ a table cell, not a table element.

> bug 975632

Same thing.

> bug 434230

Same thing.

> bug 308403

Is already marked dependent on this bug.
This bug is more than 10 years old. When might we see a fix for it?
Probably a duplicate Web Compatibility issue.
I just ran into this again on
I think one good thing to do is to figure out which of the 36 combinations of:
 - -height vs. -width (with table-layout: auto) vs. -width (with table-layout: fixed, in the first row of course)
 - min- vs. max-
 - on table vs. column vs column-group vs. row vs. row-group vs. cell
do *something* in other browsers, and whether what they do seems interoperable at a very basic level.

It may be worth filing separate bugs on many of these things rather than trying to do them all in one bug.
Flags: needinfo?(bugs)

(In reply to David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) from comment #45)
> I think one good thing to do is to figure out which of the 36 combinations
> of:
> It may be worth filing separate bugs on many of these things rather than
> trying to do them all in one bug.

I created a reduced test case for one of the Web Compat bug when I was trying to understand what was happening. See
Surprised to see how old this issue is. @karlcow's codepen illustrates the issue perfectly.

FYI, my current hack to make this work is to add any specific height in addition to the min-height declaration.  Doesn't seem like that should be needed, but it works for now.
I have noted that this case now corrected in Firefox Developer Edition 50.0a2 (will come to regular Firefox soon I hope), but now it does not override the height if somewhere before min-height, height is declared in percents (%).

Here is the sample
I'm not seeing this as being corrected in Firefox Dev edition 50.0a2.  I've attached a screenshot of it displaying your code-pen.
Whiteboard: [reflow-refactor] → [reflow-refactor] [webcompat]
Clearly ni on Jet as he no longer works at Mozilla.
Flags: needinfo?(bugs)
This is not resolved on quantum. see the above-fold element on

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

Compare also the rendering of in Firefox with all other major browsers.

min-height issue has been fixed in Bug 1651530 and that solved most of the webcompat issues

Some of the tests here are still failing for other things.

Webcompat Priority: ? → P2

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: MatsPalmgren_bugz → nobody
Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 6 duplicates, 23 votes, 51 CCs and 7 See Also bugs.
:dholbert, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dholbert)

The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.

Flags: needinfo?(dholbert)

I can't see any evidence for current webcompat issues here, and honestly I'm not sure what this bug is supposed to cover that isn't covered by If nothing, then maybe this should be closed?

Webcompat Priority: P2 → ---
Flags: needinfo?(dholbert)

(In reply to James Graham [:jgraham] from comment #68)

honestly I'm not sure what this bug is supposed to cover that isn't covered by

Per comment 12 and the patch attached there, it looks like Mats intended to address min-width/min-height on this bug, and he spun off bug 308403 as a followup to cover max-width/max-height since his patch didn't handle those. That patch from comment 12 never seems to have landed, though.

We also may have fixed this (or most/much of this) at various points over the years, though? It certainly looks like we're honoring min-height on table in the 1st testcase here, and min-width on td in the 3rd testcase, for example. I do see we have bug 1651530 as an explicit dependency that fixed up some of this, too. Per dbaron's comment 45, it's not particularly useful at this point to have this one bug covering a host of different {min/max}-{height/width} use cases, especially now that we've made progress on fixing some of them, and others of them are interoperably ignored in all browser engines.

Looking at the attached testcases, it seems we're almost entirely interoperable with Chrome except for one case in the 3rd testcase where we do honor min-width and they do not; and we're almost entirely interoperable with WebKit except for that same case, plus some cases where WebKit ignores height on tbody.

Specific results on the testcases here:

  • TABLE min-height: We match WebKit/Chromium
  • TR min-height: We match WebKit/Chromium
  • TD min-width/height: We match WebKit/Chromium, except for the last three lines where we render the three lines the same width and Chrome/WebKit do not (we're honoring the min-width:80% on the first 2 and Chrome/WebKit are not; I guess they don't support percent min-width on cells?)
  • TBODY min-height: We match WebKit/Chromium in ignoring the min-height on the tbody there. (WebKit renders one table as shorter than Chrome/Firefox, due to them also ignoring height on tbody, it seems.)
  • TBODY max-height: We match Chromium/WebKit in ignoring the max-height there. (As in the previous testcase: WebKit renders one table as shorter than Chrome/Firefox, due to them also ignoring height on tbody, it seems.)

So I think we can close this as WFM.

Closed: 19 years ago25 days ago
Resolution: --- → WORKSFORME
Flags: needinfo?(dholbert)
You need to log in before you can comment on or make changes to this bug.