views:

1465

answers:

5

I'm looking for the easiest solution to fixing a problem I have in Internet Explorer (6,7 & 8), be it CSS or using jQuery. I have a SELECT Input with a defined width (because of where it sits in the layout). Because of the defined width select is cut off from showing their full values, unlike in Firefox & Safari where they are automatically resized to show the whole length of the value..

Surely this is a common problem? Any ideas?

example code:

<select id="Grouping_662066" class="productSelectInput" name="AddToCart_Grouping" onchange="DrawProduct(36331,662066,this.value,'',true);">
</select>

I'm using a CMS system the class 'productSelectInput' is the only identifier what will be consistand across the website. The ID, name and onchange properties will change.

+1  A: 

Given those constraints, the only thing I can suggest for the IE's is to possibly reduce the size of the fonts.

I'm not certain there's a way otherwise.

jerebear
A: 

As far as I'm concerned, this is a browser issue (IE).

You can include &nbsp; to wrap the options or resize the select dynamically with Javascript on focus and blur events. Also, you could create a drop-down menu with css and javascript (no 'select', but 'ul') and have full control of the interface. (onBlur, javascript should write a the value on a hidden input).

Gerardo
+4  A: 

Here is information and a solution using jQuery.

Angel Chiang
That solution is full of wrong. The solution *it* links to but dismisses is better: http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/ie-select-width-fix.js
Crescent Fresh
the solution worked great. what perks does the solution you've recommended have over this one crescentfresh?
mattt
Oh great, glad it worked. I was referring to some of the comments near the bottom of the link. IE's document gets sharply taken out of its flow when mousing over/out of the select box. Perhaps you have nothing to the right of your select box in your page.
Crescent Fresh
no i don't actually. i guess i'll stick with this solution for my site then. i'll have a look into the one you've reccomended also for next time. thanks for the feedback!
mattt
crescentfresh, what you mention may be caused by another common problem of IE6: a fixed width containing block expands if the content is wider. The standard says it shouldn't.
Angel Chiang
A: 

if ie8 supports the psuedo-class :focus you could specify a larger width for when the select is clicked. Won't work in ie6 though, and probably not ie7

wheresrhys
A: 

it seems to do not work with internet explorer 8