IE seems to ignore the height set in CSS when rendering a HTML SELECT. Are there any work around\'s for this or do we have to just accept IE will not look as good as other b
Not sure but I think this was a question not about the height of a 'multiple' type of select element but a drop-down type of select element. I have come across times when the drop-down looks squashed and does not show clearly the selected value. Undoubtedly it has to do with CSS style info in use on the page. The only way to stop it is either change the CSS (which would likely affect the whole page or parts of it in ways you don't want affected) or use style info in the select element itself to override the CSS that's clobbering it. Example:
<select name="myselect" id="myselect" style="font-size:15px; height:30px">
<option value="someval">somedescr</option>
...
</select>
Hope this helps.
Yes, you can.
I was able to set the height of my SELECT
to exactly what I wanted in IE8 and 9. The trick is to set the box-sizing
property to content-box
. Doing so will set the content area of the SELECT
to the height, but keep in mind that margin
, border
and padding
values will not be calculated in the width/height of the SELECT
, so adjust those values accordingly.
select {
display: block;
padding: 6px 4px;
-moz-box-sizing: content-box;
-webkit-box-sizing:content-box;
box-sizing:content-box;
height: 15px;
}
Here is a working jsFiddle. Would you mind confirming and marking the appropriate answer?
Finally found in http://viralpatel.net/blogs/2009/09/setting-height-selectbox-combobox-ie.html a simple solution (at least for IE8):
font-size: 1.0em;
BTW, for Google Chrome, found this workaround at How to standardize the height of a select box between Chrome and Firefox? */
-webkit-appearance: menulist-button;
It is correct that there is no work-around for this aside from ditching the select element, but if you only need to show more items in your select list you can simply use the size attribute:
<select multiple="multiple" size="15">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
Doing this you'll have additional empty lines if your collection of items lenght is smaller than size value.
you could do similar to what facebook does, just add padding around. It is not as good as one could wish but looks reasonably well.
There is no work-around for this aside from ditching the select
element.