开发者

ASP.Net vertical alignment of controls in a panel

I have a Panel with the following:

<asp:Panel ID="Panel1" runat="server" Height="101px">
    Day
    <asp:DropDownList ID="Dr开发者_开发知识库opDownList1" runat="server" Height="24px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
    </asp:DropDownList>
    &nbsp;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?


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.


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>


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>


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


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


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>


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜