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. 保持h2大小固定
- 3. 如何在添加和排序後保持listview項目的複選框選擇?
- 4. AngularJs在選擇框中添加選項
- 5. 如何在選擇和取消選擇時固定JToggleButton大小?
- 6. jquery選擇最近的選擇框來添加選擇選項
- 7. 選擇框選定的項目保持搜索後
- 8. iPhone - 增加UIImageView的大小,並保持圖像大小固定
- 9. JavaFX FXML - 添加選項到選擇框
- 10. 保持viewpanel複選框的選擇?
- 11. jQuery將選項添加到選擇的仲裁選擇框
- 12. 如何添加複選框在PHP中的選擇選項?
- 13. 如何在選擇框中限制選項名稱的大小?
- 14. 選擇選項,堅持選定的值
- 15. Meteor.js負載在選擇持久保存選項框中
- 16. 保持兒童固定大小
- 17. 使列表項在調整大小時保持固定位置
- 18. 固定選項的多項選擇。沒有看到選項(Django)
- 19. angularjs,選擇,添加選項
- 20. 日期選擇器保持在一個固定的地方
- 21. 獲取多個選擇框選項以保持選中使用選擇
- 22. Laravel如何保持選擇選項
- 23. 在固定大小的數組上傳播選擇的算法
- 24. 禁用已被其他選擇選擇的選項(動態添加選擇框)
- 25. 需要幫助添加選擇框中的選定項到div(動態添加)
- 26. 當選擇特定選項時,添加輸入框選擇下拉
- 27. 移動選擇菜單保持當前的URL選擇選項
- 28. 選擇的onchange重新加載頁面,並保持所選擇的選項
- 29. 最小 - 最大選擇 - 複選框
- 30. 如何測量擴展組合框的大小(選擇選項)?
不知道你使用的是特定的JS框架或一些示例代碼,這將是很難看的替代品。但對於初學者,如果選擇的選項過多,則可以添加「overflow-y = auto」和「max-height」來獲取滾動條。 – Nisarg