Dropdownlist in IE9 and FF expands past monitor

2019-08-02 17:46发布

问题:

I add a simple select element (or asp.net DropDownList), with 2 items, and one is pretty long. The width is set at some value that's smaller than the item, and in IE9 and FF, the list expands when you open it. Nice. But when the select is near border of monitor, the items just go bye bye, including a scroll bar if one would exist. Functionality is all fine, but display is just cut off.

<div>
        <table style="width:1200px">
            <tr>
                <td align="right">
                    <select style="width:100px">
                        <option>Item one is very long and it goes for quite a long time</option>
                        <option>Shorter item</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>

Anyone ever come across this? Found nothing via google. We used to support only IE7 and 8, which didn't expand the list, it would just cut off the items at 100px in this example.