私はフォームのドロップダウンにselect2を使用していますが、私はテーブルレイアウトを使用していますが(これは問題の一部です)、すべてのフォームの幅グループ要素は同じです。select2 dropwdownを一定の幅に維持する方法
問題は、select2ドロップダウンにテキストを入力すると、幅が変わることです(奇妙な方法で)。ブラウザがselect2ドロップダウンを固定したままにする最初の幅を強制する方法はありますか?
<table>
<tr>
<td>
<div class="row">
<div class="form-group">
<label>Title</label>
<input name="title" class="form-control"/>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="row">
<div class="form-group">
<label>a label</label>
<input class="form-control"/>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="row">
<div class="form-group">
<label>a label</label>
<select id="tag_list" class='form-control' multiple="multiple">
<option value='1'>abba</option>
<option value='2'>zabba</option>
<option value='3'>doo</option>
</select>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="row">
<div class="form-group">
<label for="category_type">Category Type:</label>
<select name="category_type" id="category_type_list" class="form-control">
<option value="" disabled selected>If there is a matching type for the category, please select it</option>
<option value="1">A</option>
<option value="2">B</option>
</select>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="row action">
<div class="form-group">
<div class="inline">
<button class="btn btn-primary form-control" type="submit">submit</button>
</div>
<div class="inline">
<button class="btn btn-primary cancel">Cancel</button>
</div>
</div>
</div>
</td>
</tr>
</table>
と私のCSS:
.form-group{
display: block;
}
table {
margin-left: 5%;
table-layout: fixed;
}
input {
height: 30px;
border: 1px solid #e3e3e3;
padding: 3px 10px;
width: 100%;
}
.inline{
float:left;
margin-right: 5px;
}
span.select2-container{
width: 100% !important;
tex-overflow: ellipsis;
}
Hereはフィドル例です
は、ここに私のhtmlです。あなたはselect2ドロップダウンに十分長い時間を入力し、幅が変わるのを見てEnterを押すことで試してみることができます。それをどうやって止めることができますか?
これは固定ですか?私はいくつかのアイデアを持っていますが、私はあなたのフィドルで本当の問題は見ません。 – Bindrid
いいえ、その固定されていません。フィドルでは、 "短い説明..."のプレースホルダーを持つ3番目の入力に何か長い単語を入力してからenterを押します。 Enterキーを押すと幅が変わることがわかります。私はそれが起こるのをやめてほしい – user3494047