2017-07-19 16 views
0

私のような都市セレクタ選択オプションがあります:私はしたい enter image description here追加オプションで選択ボックスのサイズの修正を維持

enter image description here

を私は複数の都市、このようなセレクタが増加のサイズを選択すると、箱のサイズの修正を維持する。どんな解決策ですか?

+3

あなたが使用している特定のJSのフレームワークやいくつかのサンプルコードを知らなくても、選択肢を見ることは困難であろう。しかし、あまりにも多くのオプションが選択されている場合は、最初に 'overflow-y = auto'と' max-height'を追加してスクロールバーを得ることができます。 – Nisarg

答えて

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>

関連する問題