如何在asp.net下拉列表控件中垂直对齐文本? 我研究了网络,发现了一些带填充等的解决方案,但似乎都没有用。 这是我的代码。
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="dropdown">
<asp:ListItem>sds</asp:ListItem>
<asp:ListItem>ddd</asp:ListItem>
<asp:ListItem>xxx</asp:ListItem>
</asp:DropDownList>
CSS:
.dropdown
{
height: 35px;
background-color: Blue;
font-size: 15px;
padding-top: 10px;
padding-bottom: 10px;
}
答案 0 :(得分:0)
添加等于高度的行高:
.dropdown {
height: 35px;
line-height: 35px;
...
}
答案 1 :(得分:0)
填充将起作用。检查以下jsfiddle
<select class="dropdown">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
.dropdown {
background-color: Blue;
font-size: 15px;
padding-top: 10px;
padding-bottom: 10px;
}