ASP.Net 面板中控件的垂直对齐

发布于 2024-08-10 02:36:39 字数 623 浏览 5 评论 0原文

我有一个包含以下内容的面板:

<asp:Panel ID="Panel1" runat="server" Height="101px">
    Day
    <asp:DropDownList ID="DropDownList1" runat="server" Height="24px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
    </asp:DropDownList>
    &nbsp;Hour
    <asp:DropDownList ID="DropDownList2" runat="server">
    </asp:DropDownList>
</asp:Panel>

文本(“日”和“小时”)似乎相对于下拉框有不同的垂直对齐

替代文本 http://img215.imageshack.us/img215/115/paneld.jpg

如何轻松解决此问题?

I have a Panel with the following:

<asp:Panel ID="Panel1" runat="server" Height="101px">
    Day
    <asp:DropDownList ID="DropDownList1" runat="server" Height="24px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
    </asp:DropDownList>
     Hour
    <asp:DropDownList ID="DropDownList2" runat="server">
    </asp:DropDownList>
</asp:Panel>

The texts ("Day" and "Hour") seem to have a different vertical alignment with respect to the dropdownboxes

alt text http://img215.imageshack.us/img215/115/paneld.jpg

How do I fix this easily?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

要走就滚别墨迹 2024-08-17 02:36:39

我偶然发现的一个解决方案是将文本和 DropDownLists 包含在一个带有单行的表格中,并为每个文本/Dropbox 提供一个单独的单元格。就像魅力一样。

One solution I stumbled on to was to enclose the text and DropDownLists in a Table with a single row and have a separate cell for each text/dropbox. Works like a charm.

可是我不能没有你 2024-08-17 02:36:39

这真的很简单:

<div>
    Day
    <asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
    Hour
    <asp:DropDownList ID="DropDownList2" runat="server">
    </asp:DropDownList>
</div>

It's really this simple:

<div>
    Day
    <asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
    Hour
    <asp:DropDownList ID="DropDownList2" runat="server">
    </asp:DropDownList>
</div>
满地尘埃落定 2024-08-17 02:36:39

不确定你是否尝试过这个...

<div style="vertical-align:top"> 
    Day 
    <asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom"> 
    </asp:DropDownList> 
    Hour 
    <asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom"> 
    </asp:DropDownList>  
</div>

Not sure you tried this or not...

<div style="vertical-align:top"> 
    Day 
    <asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom"> 
    </asp:DropDownList> 
    Hour 
    <asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom"> 
    </asp:DropDownList>  
</div>
飘然心甜 2024-08-17 02:36:39

您是否尝试过使用 style 属性调整垂直对齐方式?
http://www.w3schools.com/Css/pr_pos_vertical-align.asp

Have you tried adjusting the vertical alignment using the style attribute?
http://www.w3schools.com/Css/pr_pos_vertical-align.asp

栖竹 2024-08-17 02:36:39

尝试将标签形成为或在标签周围添加一些空格。它可能正在缠绕。

Try forming your tags as or add some whitespace around them. It may be wrapping.

爱本泡沫多脆弱 2024-08-17 02:36:39

如果你还没有尝试这个

<div style="vertical-align:top">
Day 
<asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom">
</asp:DropDownList>
Hour 
<asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom>
</asp:DropDownList>
</div>

try this if you haven"t

<div style="vertical-align:top">
Day 
<asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom">
</asp:DropDownList>
Hour 
<asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom>
</asp:DropDownList>
</div>
献世佛 2024-08-17 02:36:39

另一个答案有格式问题。又来了。

不确定你是否尝试过:

<div style="vertical-align:top"> 
  Day 
  <asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom"> 
  </asp:DropDownList> 
   Hour 
  <asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom"> 
   </asp:DropDownList> 
</div>

That other answer had formatting issues. Here is it again.

Not sure you tried it or not:

<div style="vertical-align:top"> 
  Day 
  <asp:DropDownList ID="DropDownList1" runat="server" style="vertical-align:bottom"> 
  </asp:DropDownList> 
   Hour 
  <asp:DropDownList ID="DropDownList2" runat="server" style="vertical-align:bottom"> 
   </asp:DropDownList> 
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文