0

我正在使用来自该站点的脚本 jQuery 自定义选择框(当前版本:0.6.1):

http://info.wsisiz.edu.pl/~suszynsk/jQuery/demos/jquery-selectbox/

我的问题是,“jquery-selectbox-list jquery-custom-selectboxes-replaced-list”类的宽度和高度是由内联样式分配设置的。

我的原始代码如下所示:

<span class="anrede">
Anrede<br />
<select name="anrede" id="anrede" value="[[!+fi.anrede]]" >
<option value="select"></option>
<option value="Frau">Frau</option>
<option value="Herr">Herr</option>
</select>
</span>

如果我在 Firebug 中查看该站点的源代码,代码会更改如下:

<span class="anrede">
Anrede
<br>
<div class="jquery-selectbox jquery-custom-selectboxes-replaced" style="width: 125px;">
<div class="jquery-selectbox-moreButton"></div>
<div class="jquery-selectbox-list jquery-custom-selectboxes-replaced-list" style="width: 120px; height: 3em; display: none;">
<span class="jquery-selectbox-item value-select item-0"></span>
<span class="jquery-selectbox-item value-Frau item-1">Frau</span>
<span class="jquery-selectbox-item value-Herr item-2">Herr</span>
</div>
<span class="jquery-selectbox-currentItem"></span>
<select id="anrede" value="" name="anrede" style="display: none;">
<option value="select"></option>
<option value="Frau">Frau</option>
<option value="Herr">Herr</option>
</select>
</div>
</span>

我的问题是第三个 div 类:

<div class="jquery-selectbox-list jquery-custom-selectboxes-replaced-list" style="width: 120px; height: 3em; display: none;">

如您所见,这是一个内联样式分配,这导致了我的布局问题。有谁知道如何解决这个问题?

提前干杯!

4

1 回答 1

1

只需将 !important 添加到您的 CSS 规则中,如下所示:

.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list {
    width: yourvaluepx !important;
    height: yourvaluepx !important;
}
于 2013-03-07T14:13:10.977 回答