bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

max-height and min-height is not working at all for select (even if height is working)




Layout: Form Controls
7 years ago
3 years ago


(Reporter: brunoais, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



7 years ago
User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0

The CSS properties max-height and min-height are not being rendered by firefox when applied to select boxes.
This works in firefox 3.5.* and 3.6.* but is not working in firefox 4.0.

Reproducible: Always

Steps to Reproduce:
1. Prepare an HTML page
2. Write CSS code to create a max-width, a min-width and overflow:scroll for the selectbox
3. See what happens.

1. Prepare an HTML page
2. Write CSS code to create a max-width, a min-width and overflow:scroll for the selectbox
3. Prepare javascript code to add and remove options from the selectbox at will
4. See what happens as you add and remove options.
Actual Results:  
The selectbox has always the same size no matter how many options it has and if I add how many times I add or remove options

Expected Results:  
The selectbox should adapt to the size given from the smallest size to the biggest size like firefox 3.6.16 does.
It starts with the size given in min-height and increase size as I add options until it reaches the maximum size I gave it. Then add (if didn't already had) a scroll bar to the left to allow scrolling the options

I'm using the safe-mode to check what I am writting.
Please upload a testcase that demonstrates the problem.  Thanks.
(use the "Add an attachment" link on this bug report)
Component: Style System (CSS) → Layout: Form Controls
Keywords: testcase-wanted
QA Contact: style-system → layout.form-controls
Yeah, I can't reproduce this.

Comment 3

7 years ago
You've got the the file. Please see if you have the problem too.
What file are you talking about, exactly?

Comment 5

7 years ago
I mean: I attached the file now.

Comment 6

7 years ago
Created attachment 526038 [details]
Here is an example code where the problem exists

Here is an example of the problem working. This works in firefox 3.6.16 as expected and it does not work in firefox 4.0 (in safe mode)

Comment 7

7 years ago
Dunno why, the earlier attachment didn't work
Oh, I see what you're talking about.

Your styles require that the height be between 40px and 100px.  Any layout within those constraints is correct.  The intrinsic height of a <select> used to depend on the number of options in Firefox 3.6, but this violated the HTML5 spec for <select>, which is very clear:

  If the multiple attribute is present, then the size attribute's default
  value is 4.

which means that a <select multiple> with no 'size' set must act the same as if you set size="4".  So the intrinsic height must be the same as if size="4" is set.

So what you see in Firefox 4 is the behavior the spec calls for.
Last Resolved: 7 years ago
Resolution: --- → INVALID

Comment 9

7 years ago
I see... Firefox 4 follows the html5 specification even in HTML4.01. I just consulted and tried to find and reread, etc... the html4 strict specification (corresponds to the doctype I used) and it seems like that the HTML5 behavior does not violate the html4 specification either... So having the HTML5 behavior for HTML4 is valid.

So... How can I accomplish this using CSS? Now I have no ideas...


7 years ago
Severity: normal → minor
For what it's worth, we only have one HTML mode (modulo quirks mode, of course).

I'm not sure there's a good way to get the old behavior without changing the "size" attribute to match the count of the options in your script.  But doing that ought to work.
Keywords: testcase-wanted
You need to log in before you can comment on or make changes to this bug.