0

Basically I autofill the expense description based on what expense category is chosen, and the select won't widen based on the content that is in the box.

Of course this works perfectly fine on chrome, firefox and safari.

Anyone have any ideas as to why it won't auto widen like the other browsers? Or how I can force it to? I don't have the width constrained by CSS.

enter image description here

Thanks in advance!

Geesu
  • 5,928
  • 11
  • 43
  • 72

1 Answers1

1

This should fix it for IE8:

select:focus {
   position: relative; /* needed if the parent element has assigned width */
   width: auto;
}
Toni Toni Chopper
  • 1,833
  • 2
  • 20
  • 29
  • the select has width: auto? – Toni Toni Chopper Nov 30 '12 at 15:36
  • Yes, I added width:auto and what you added above. – Geesu Nov 30 '12 at 15:40
  • And the TD that it's in doesn't have a width set, quite strange! – Geesu Nov 30 '12 at 15:48
  • This is an IE8 limitation (I tend to consider it a bug...). I misunderstood your question, you want the auto-width on the select element at all times, not only when you select an option (to prevent the crop). I think there might be a jQuery plugin or more complex solutions for that. This SO question might help http://stackoverflow.com/questions/73960/dropdownlist-width-in-ie Good luck! – Toni Toni Chopper Nov 30 '12 at 15:52
  • 1
    Thanks! What's funny is if I add a new row to my table, it automatically corrects the previous rows (as shown in the image), so I know there must be a solution somewhere! heh I REALLY hate IE! – Geesu Nov 30 '12 at 15:57
  • 1
    Another comment: It's displaying wrong b/c it was running in IE7 Standard mode, don't ask me why (intranet settings I believe), your fix works for IE8 Standards Mode – Geesu Nov 30 '12 at 16:01
  • Good to hear, I was scratching my head... :) – Toni Toni Chopper Nov 30 '12 at 16:05