gpt4 book ai didi

jquery - 如何使用 css 更改一个选择框选项文本 (select2) 的字体大小?

转载 作者:技术小花猫 更新时间:2023-10-29 11:18:03 31 4
gpt4 key购买 nike

我想更改其中一个选择框的字体大小。但它不起作用:

http://jsfiddle.net/jEADR/3717/

 <link href="http://cdnjs.cloudflare.com/ajax/libs/select2/3.2/select2.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/select2/3.2/select2.min.js"></script>



<select id="e1" class="select2" style="width:300px">
<option value="AL">Alabama</option>
<option value="Am">Amalapuram</option>
<option value="An">Anakapalli</option>
<option value="Ak">Akkayapalem</option>
<option value="WY">Wyoming</option>
</select>

<select id="e2" class="select2" style="width:300px">
<option value="AL">Alabama</option>
<option value="Am">Amalapuram</option>
<option value="An">Anakapalli</option>
<option value="Ak">Akkayapalem</option>
<option value="WY">Wyoming</option>
</select>
<style>
#e2 .select2-results{
font-size:4px;
}
</style>

<script>
$(".select2").select2();
</script>

最佳答案

解决方法:

http://jsfiddle.net/jEADR/3730/

<select  id="e1" class="select2" style="width:300px">
<option value="AL">Alabama</option>
<option value="Am">Amalapuram</option>
<option value="An">Anakapalli</option>
<option value="Ak">Akkayapalem</option>
<option value="WY">Wyoming</option>
</select>

<select id="e2" class="select2" style="width:300px">
<option value="AL">Alabama</option>
<option value="Am">Amalapuram</option>
<option value="An">Anakapalli</option>
<option value="Ak">Akkayapalem</option>
<option value="WY">Wyoming</option>
</select>

<script>
$(".select2").select2();
$("#e2").select2({ dropdownCssClass: "myFont" });
</script>

.myFont{
font-size:4px;
}

关于jquery - 如何使用 css 更改一个选择框选项文本 (select2) 的字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42788525/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com