垂直在asp.net下拉列表控件对齐文本 [英] Vertically align text in a asp.net dropdown list control

查看:146
本文介绍了垂直在asp.net下拉列表控件对齐文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何垂直对齐在asp.net DropDownList控件的文本?
我研究了网页,发现几个提出解决方案,填充等,但似乎没有工作。
这是我的code。

 < ASP:DropDownList的ID =DropDownList1=服务器的CssClass =下拉菜单>
    < ASP:ListItem的> SDS< / ASP:ListItem的>
    < ASP:ListItem的>&DDD LT; / ASP:ListItem的>
    < ASP:ListItem的> XXX和LT; / ASP:ListItem的>
    < / ASP:DropDownList的>

CSS:

  .dropdown
{
    高度:35px;
    背景色:蓝色;
    字体大小:15像素;
    填充顶:10px的;
    填充底:10px的;
}


解决方案

添加线的高度等于高度:

  .dropdown {
    高度:35px;
    行高:35px;
    ...
}

How do I vertically align a text in a asp.net dropdownlist control? I researched the web and found several proposed solutions with padding etc. but none seem to work. This is my code.

 <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;    
}

解决方案

Add line-height equal to the height:

.dropdown {
    height: 35px;
    line-height: 35px;
    ...
}

这篇关于垂直在asp.net下拉列表控件对齐文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆