是否有顶部对齐标签,他们控制了坚实的方式吗? [英] Is there a solid way to top align labels to their controls?

查看:109
本文介绍了是否有顶部对齐标签,他们控制了坚实的方式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个简单的解决方案,CSS,这将迫使标签顶部与他们在ASP控制对齐。因此,例如:

I'm looking for a straight forward css solution that will force labels to top align with their controls in asp. So for example:

<asp:Label runat="server" AssociatedControlID="cboBox" Text="Control Label" />
<asp:DropDownList runat="server" ID="cboBox" />

似乎是这样的:

Control Label
[[[[[]]]]]]]]]]]]V

任何想法?

推荐答案

总结他们无论是在SPAN或DIV:

Wrap them both in a span or div:

<span class="field">
    <asp:Label runat="server" AssociatedControlID="cboBox" Text="Control Label" />
    <asp:DropDownList runat="server" ID="cboBox" />
</span>

然后:

.field label,
.field select
{
    display: inline-block;
    vertical-align: top;

    /* achieves same as inline-block for IE7 */
    *display: inline;
    *zoom: 1;
}

这篇关于是否有顶部对齐标签,他们控制了坚实的方式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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