Last Comment Bug 307866 - min-width/min-height/max-width/max-height does not work for table elements
: min-width/min-height/max-width/max-height does not work for table elements
Status: NEW
: css2, testcase
Product: Core
Classification: Components
Component: Layout: Tables (show other bugs)
: Trunk
: All All
: -- normal with 23 votes (vote)
: ---
Assigned To: Mats Palmgren (:mats)
: 227650 394472 453034 977929 1206271 1221721 (view as bug list)
Depends on:
Blocks: 308403
  Show dependency treegraph
Reported: 2005-09-10 03:41 PDT by Giampaolo Bellavite
Modified: 2016-10-20 18:16 PDT (History)
40 users (show)
bugs: needinfo? (bugs)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Example file (1.46 KB, text/html)
2005-09-10 03:43 PDT, Giampaolo Bellavite
no flags Details
TABLE min-height (1.13 KB, text/html)
2005-09-13 17:38 PDT, Mats Palmgren (:mats)
no flags Details
TR min-height (859 bytes, text/html)
2005-09-13 17:39 PDT, Mats Palmgren (:mats)
no flags Details
TD min-width/height (2.06 KB, text/html)
2005-09-13 17:40 PDT, Mats Palmgren (:mats)
no flags Details
TBODY min-height (1.13 KB, text/html)
2005-09-13 17:41 PDT, Mats Palmgren (:mats)
no flags Details
TBODY max-height (1.14 KB, text/html)
2005-09-13 17:43 PDT, Mats Palmgren (:mats)
no flags Details
Patch rev. 1 (35.10 KB, patch)
2005-09-13 17:50 PDT, Mats Palmgren (:mats)
bernd_mozilla: review-
Details | Diff | Splinter Review

Description Giampaolo Bellavite 2005-09-10 03:41:59 PDT
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
Comment 1 Giampaolo Bellavite 2005-09-10 03:43:03 PDT
Created attachment 195521 [details]
Example file
Comment 2 Giampaolo Bellavite 2005-09-10 04:02:20 PDT
I found the CSS2 specification doesn't allow the max-height property in table cells:
So I guess this is not really a bug.
Comment 3 Erik Fabert 2005-09-10 08:41:50 PDT
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. 
Comment 4 Adam Guthrie 2005-09-10 11:47:18 PDT
INVALID per comments 2 and 3.
Comment 5 David Baron :dbaron: ⌚️UTC-8 2005-09-10 12:21:33 PDT
You misread comment 3.
Comment 6 Mats Palmgren (:mats) 2005-09-13 17:38:04 PDT
Created attachment 195974 [details]
TABLE min-height
Comment 7 Mats Palmgren (:mats) 2005-09-13 17:39:37 PDT
Created attachment 195975 [details]
TR min-height
Comment 8 Mats Palmgren (:mats) 2005-09-13 17:40:48 PDT
Created attachment 195976 [details]
TD min-width/height
Comment 9 Mats Palmgren (:mats) 2005-09-13 17:41:48 PDT
Created attachment 195977 [details]
TBODY min-height
Comment 10 Mats Palmgren (:mats) 2005-09-13 17:43:59 PDT
Created attachment 195978 [details]
TBODY max-height
Comment 11 Mats Palmgren (:mats) 2005-09-13 17:50:24 PDT
Created attachment 195979 [details] [diff] [review]
Patch rev. 1
Comment 12 Mats Palmgren (:mats) 2005-09-13 18:20:26 PDT
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).
Comment 13 Bernd 2005-09-27 09:06:46 PDT
*** Bug 227650 has been marked as a duplicate of this bug. ***
Comment 14 Bernd 2005-10-05 12:57:04 PDT
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 15 Bernd 2005-10-07 06:23:30 PDT
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.
Comment 16 2006-08-01 05:46:41 PDT
Out of curiousity... has this bug been forgotten?
Comment 17 Boris Zbarsky [:bz] (still a bit busy) 2006-08-01 07:42:10 PDT
No point working on this until reflow branch lands, since that rewrites pretty much all of BasicTableLayoutStrategy.
Comment 18 Kelly Miyashiro 2006-10-24 17:26:56 PDT
2.0 is out, any news on when the reflow branch will land and when this will be fixed?
Comment 19 Boris Zbarsky [:bz] (still a bit busy) 2006-10-24 19:14:32 PDT
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
Comment 20 Raj Bhaskar 2007-01-19 01:30:21 PST
Now that the reflow branch has landed, will this bug be revisited?
Comment 21 Boris Zbarsky [:bz] (still a bit busy) 2007-01-19 01:34:47 PST
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...  ;)
Comment 22 Bernd 2007-01-20 23:38:14 PST
Most of the patch is obsolete due to the reflow branch landing.
Comment 23 Brian Polidoro 2007-08-31 13:38:47 PDT
*** Bug 394472 has been marked as a duplicate of this bug. ***
Comment 24 James Barrante 2008-01-06 16:49:18 PST
This is still alive.

Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9b3pre) Gecko/2008010605 Minefield/3.0b3pre
Comment 25 Brian Polidoro 2008-08-31 09:30:16 PDT
*** Bug 453034 has been marked as a duplicate of this bug. ***
Comment 26 Oet 2009-07-07 10:45:32 PDT
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..
Comment 27 Will Pittenger 2009-09-07 04:43:27 PDT
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.
Comment 28 Boris Zbarsky [:bz] (still a bit busy) 2009-09-07 05:38:23 PDT
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.
Comment 29 Oet 2009-12-04 14:24:40 PST

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...
Comment 30 Danilo Câmara 2011-04-23 13:37:32 PDT Comment hidden (off-topic)
Comment 31 Danilo Câmara 2011-04-23 14:24:02 PDT Comment hidden (off-topic)
Comment 32 Boris Zbarsky [:bz] (still a bit busy) 2011-04-23 17:26:39 PDT
Danilo, comments 30 and 31 have nothing to do with this bug.
Comment 34 Chris 2014-01-17 14:28:02 PST
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).
Comment 35 Boris Zbarsky [:bz] (still a bit busy) 2014-02-28 12:06:22 PST
*** Bug 977929 has been marked as a duplicate of this bug. ***
Comment 36 Jeff Muizelaar [:jrmuizel] 2014-11-26 11:41:57 PST
This page is broken in Firefox because of this:
Comment 37 Dennis Haney 2014-12-18 01:49:20 PST
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.
Comment 38 Robert Longson 2015-09-19 00:04:46 PDT
*** Bug 1206271 has been marked as a duplicate of this bug. ***
Comment 39 Keul 2015-10-11 15:11:39 PDT
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
Comment 40 Boris Zbarsky [:bz] (still a bit busy) 2015-10-12 07:53:18 PDT
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.
Comment 41 Boris Zbarsky [:bz] (still a bit busy) 2015-11-04 12:09:16 PST
*** Bug 1221721 has been marked as a duplicate of this bug. ***
Comment 42 Brad 2016-03-10 07:50:49 PST
This bug is more than 10 years old. When might we see a fix for it?
Comment 43 Karl Dubost :karlcow 2016-07-10 17:41:05 PDT
Probably a duplicate Web Compatibility issue.
Comment 44 Jeff Muizelaar [:jrmuizel] 2016-07-12 09:03:07 PDT
I just ran into this again on
Comment 45 David Baron :dbaron: ⌚️UTC-8 2016-07-12 14:27:01 PDT
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.
Comment 46 Karl Dubost :karlcow 2016-07-12 15:40:13 PDT

(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
Comment 47 Square Candy Design 2016-08-25 19:06:16 PDT
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.
Comment 48 joviczarko 2016-09-15 00:18:47 PDT
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
Comment 49 mac 2016-09-23 06:13:40 PDT
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.
Comment 50 Karl Dubost :karlcow 2016-10-20 18:16:44 PDT
Adding another case

Note You need to log in before you can comment on or make changes to this bug.