我正在尝试使用 DropDown 实现两件事。
- 首先,我想将文本包装在下拉列表中的选项列表中。
- 其次,我想在每个选项之后加上一个边框
我想支持 IE(以及其他浏览器)。
这是因为我会在下拉列表中有很长的文本,我不想剪掉它们。出于这个原因,我想做上述的事情。
像这样的东西: -
http://jsfiddle.net/fnagel/GXtpC/embedded/result/
选择具有“与选项文本格式相同,选择地址”的选项。请注意选项是如何格式化的,并且每个选项都有一个边框底部。
这是我尝试过的(文本):-
.myselect {
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
}
.myselect option {
white-space: nowrap;
width: 100% border-bottom: 1px #ccc solid;
/* This doesn't work. */
}
<select name="d" class="myselect">
<option value="sdf" class="test1"> line text How to wrap the big line text </option>
<option value="sdf2" class="test1"> line text How to wrap the big line text </option>
<option value="sdf3" class="test1"> line text How to wrap the big line text </option>
<option value="sdf4" class="test1"> line text How to wrap the big line text </option>
</select>