Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Good question. A bit of a rant here but IE's implementation of <code>&lt;select&gt;</code> controls is abysmal. It has the following problems (among others I'm sure):</p> <ul> <li>(As you've noticed) setting the width on the <code>&lt;select&gt;</code> cuts off <code>&lt;option&gt;</code> elements, regardless of <code>overflow</code> instructions</li> <li>they have this <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;177378&amp;Product=iep" rel="nofollow noreferrer">magic ability to sit overtop of <em>all</em> other controls on the page</a>, regardless of position and layering (<code>z-index</code>) instructions. This was a huge PITA for early developers of "dialog" widgets; any dropdowns behind the dialog would bleed through overtop of the dialog itself.</li> <li><a href="http://www.lattimore.id.au/2005/06/18/disable-options-in-a-select-dropdown-element/" rel="nofollow noreferrer">you cannot disable individual <code>&lt;option&gt;</code> elements</a></li> <li><a href="http://codylindley.com/Webdev/315/ie-hiding-option-elements-with-css-and-dealing-with-innerhtml" rel="nofollow noreferrer">you cannot hide/show individual <code>&lt;option&gt;</code> elements</a></li> <li>the <code>&lt;select&gt;</code> does not reflect css styles set on the selected <code>&lt;option&gt;</code></li> <li><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;276228" rel="nofollow noreferrer">can't set the <code>innerHTML</code> property to a string of new option items</a></li> <li>if you do <em>not</em> set a <code>value</code> attribute on each <code>&lt;option&gt;</code>, <code>mySelectBox.value</code> silently fails </li> <li>when using the keyboard arrows to navigate throught the list of <code>&lt;option&gt;</code> elements, the <code>change</code> event fires on every keystroke (Opera has this problem too)</li> <li>css styles on <code>&lt;option&gt;</code>s and <code>&lt;optgroup&gt;</code>s are generally completely ignored (<a href="http://msdn.microsoft.com/en-us/library/ms535877(VS.85,loband).aspx" rel="nofollow noreferrer">only <code>backgound-color</code> and <code>color</code> work</a>)</li> <li>programmatically changing the options list hides the dropdown (this sucks for "type ahead" implementation attempts who want the dropdown to stay visible)</li> <li>IE7 tries to fit all the options on the screen when shown. For large lists this means the dropdown content will sit overtop of the dropdow when shown (this in and of itself is not wrong, but it is inconsistent with other IE versions)</li> </ul> <p>As for your problem, one solution is to toggle the <code>width</code> to <code>"auto"</code> when the options are shown, and set if back to a set width when the options are closed, as outlined here: <a href="http://css-tricks.com/select-cuts-off-options-in-ie-fix/" rel="nofollow noreferrer">http://css-tricks.com/select-cuts-off-options-in-ie-fix/</a></p> <p>The obvious drawback of this is that the screws up the flow of the document as neighboring elements all shift around to account for <code>width:auto</code> setting.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload