0
A
回答
0
如果我明白了,那就是你想要的。隨着任何變化,力的最大寬度和高度。
.select {
/** Want to have permanant width 150px **/
width:150px;
max-width:150px;
background:lightblue;
padding:3px;
height:150px;
overflow-y:auto;
/** the magic think **/
word-break:break-word;
}
.option {
background:tomato;
width:100%; /** or display block in your case (for the tags selected) **/
}
.option:nth-child(odd) {
background:lightgreen;
}
<div class="select">
<div class="option">testttt</div>
<div class="option">testtttttttttttttttesttttttttttttttttesttttttttttttttt</div>
<div class="option">testttttttttttttttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
<div class="option">testttt</div>
</div>
相關問題
- 1. 樹選擇與複選框 - 固定大小的輸入欄
- 2. AngularJs在選擇框中添加選項
- 3. 如何在選擇和取消選擇時固定JToggleButton大小?
- 4. iPhone - 增加UIImageView的大小,並保持圖像大小固定
- 5. JavaFX FXML - 添加選項到選擇框
- 6. jQuery將選項添加到選擇的仲裁選擇框
- 7. 如何在選擇框中限制選項名稱的大小?
- 8. 固定選項的多項選擇。沒有看到選項(Django)
- 9. 在固定大小的數組上傳播選擇的算法
- 10. Laravel如何保持選擇選項
- 11. 禁用已被其他選擇選擇的選項(動態添加選擇框)
- 12. 選擇的onchange重新加載頁面,並保持所選擇的選項
- 13. 最小 - 最大選擇 - 複選框
- 14. 如何更新選擇的選項,但保持先前選擇的選項?
- 15. 保持選擇
- 16. 保持選擇多個選項中的選項PHP
- 17. 更改選擇選項字體大小
- 18. 選擇選項字體大小
- 19. 保存在元框中選定選項
- 20. 選擇框選項在IE中添加,但不在Firefox中
- 21. ReduxForm選擇值選項被過濾去除,但選項保持選定
- 22. jquery選擇:大小選擇
- 23. 反應 - 選擇:保持菜單中的選定項目
- 24. jQuery添加/刪除多個選擇框選項到文本框
- 25. 更改固定大小的選擇標記中的列
- 26. 複選框大小增加
- 27. 選擇框在清空時不刷新,然後添加選項
- 28. jQuery在選擇框中添加空白選項字段
- 29. 如何在ZK組合框中添加「選擇一個...」選項
- 30. 選擇的具體選項在下一個選擇中添加選項
不知道你使用的是特定的JS框架或一些示例代碼,這將是很難看的替代品。但對於初學者,如果選擇的選項過多,則可以添加「overflow-y = auto」和「max-height」來獲取滾動條。 – Nisarg