我遇到一个奇怪的问题,其中行数据输入大小大于我的下拉列表框的宽度。当发生这种情况时,文本正在缩短。
正在发生的一些例子是: -
守则如下: -
<div class="level select">
<select id="MainContent_cmbClientName" style="width:140px;">
<option selected="selected" value="Select One Two Three Four Five Six Seven Eight">Select One Two Three Four Five Six Seven Eight</option>
<option value="Select One Two Three Four Five Six Seven Eight">Select One Two Three Four Five Six Seven Eight</option>
<option value="Select One Two Three Four Five Six Seven Eight">Select One Two Three Four Five Six Seven Eight</option>
<option value="Select One Two Three Four Five Six Seven Eight">Select One Two Three Four Five Six Seven Eight</option>
<option value="Select One Two Three Four Five Six Seven Eight">Select One Two Three Four Five Six Seven Eight</option>
</select>
</div>
<select size="4" id="MainContent_lstFamilyStatus" class="client-bg-repeat" style="color:#000060;">
<option value="1">Couple</option>
<option value="2">Family with 2+ Children</option>
<option value="3">Family with One Child</option>
<option value="4">Single Female</option>
<option value="5">Single Female and not willing to marry</option>
</select>
我有什么方法可以解决这个问题,或者可能会将文本带到由于文本溢出而被剪切的下一行。
非常感谢。
答案 0 :(得分:0)
<style>
.ctrDropDown{
width:145px;
font-size:11px;
}
.ctrDropDownClick{
font-size:11px;
width:300px;
}
.plainDropDown{
width:145px;
font-size:11px;
}
</style>
<select name="someDropDown" id="someDropDown" class="ctrDropDown" onBlur="this.className='ctrDropDown';" onMouseDown="this.className='ctrDropDownClick';" onChange="this.className='ctrDropDown';">
<option value="">This is option 1.</option>
<option value="">This is the second option, a bit longer.</option>
<option value="">Drink to me only with thine eyes, and I will pledge with mine...</option>
</select>
它有效(感谢Doug Boud)。
感谢。