ImageButton对齐问题

hling 2009-02-27 11:48:11
在使用ImageButton控件与文本框时,两者之间无法对齐,表现为:ImageButton老是偏上显示。请问怎么解决 ?
...全文
269 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
ysw830 2009-02-27
  • 打赏
  • 举报
回复
把每个控件放在单独的<td></td>里,设置valign="top" 这样看上去顶部都对齐了
<table width="835" border=0 align=center cellPadding=2 cellSpacing=1 bgcolor="#C0D5DC" class=color3>
<tr bgcolor="#F4FAFF">
<td height="25" align=right bgcolor="#F4F7FA" class=style1 valign="top" >
<asp:Label ID="Label5" runat="server">请选择:</asp:Label>
</td>
<td class="style2" valign="top">
<asp:DropDownList ID="comCollectionId" runat="server" Height="16px"></asp:DropDownList>
</td>
<td valign="top">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/zp-an05-1.gif" Height="21px" Width="30px" />
</td>
<td class="style3" valign="top">
选择:
</td>
<td class="style4" valign="top">
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
</td>
<td valign="top">
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/zp-an05-2.gif" />

</td>
</tr>
</table>
LXHGDDY 2009-02-27
  • 打赏
  • 举报
回复
试着用div去实现怎么样,我们一般都是用层去控制的
qshurufa 2009-02-27
  • 打赏
  • 举报
回复
<td>套<table>呗
Amy_wang 2009-02-27
  • 打赏
  • 举报
回复
我程序兼美工,累
henry20176666 2009-02-27
  • 打赏
  • 举报
回复
是个这么个问题 让你们的美工调贝
Amy_wang 2009-02-27
  • 打赏
  • 举报
回复
楼主,不要把几个控件放到一个td里,不容易控制位置,分别放到单独的td,设置相同的样式就可以了
<table width=835 border=0 align=center cellPadding=2 cellSpacing=1 bgcolor="#C0D5DC">
<tbody>

<tr bgcolor="#F4FAFF">
<td height="25" align=center bgcolor="#F4F7FA" valign="bottom">请选择
<asp:DropDownList ID="comCollectionId" runat="server"></asp:DropDownList></td>
<td height="25" align=center bgcolor="#F4F7FA" valign="bottom">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="" /></td>
<td height="25" align=center bgcolor="#F4F7FA" valign="bottom">选择: <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList> </td>
<td height="25" align=center bgcolor="#F4F7FA" valign="bottom"> <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl=""/></td>
</tr>
</tbody>
</table>
Amy_wang 2009-02-27
  • 打赏
  • 举报
回复
我调调看,,
hling 2009-02-27
  • 打赏
  • 举报
回复

<TABLE width=835
border=0 align=center cellPadding=2 cellSpacing=1 bgcolor="#C0D5DC" class=color3>
<TBODY>

<TR bgcolor="#F4FAFF">
<TD height="25" align=center bgcolor="#F4F7FA" class=color2 valign="bottom">
<asp:Label ID="Label5" runat="server">请选择:</asp:Label><asp:DropDownList ID="comCollectionId" runat="server">
</asp:DropDownList>
  <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/zp-an05-1.gif"
OnClick="ImageButton1_Click" />
      选择:<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
 
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/zp-an05-2.gif"
OnClick="ImageButton2_Click" /></TD>
</TR>
</TBODY>
</TABLE>


xfreyes 2009-02-27
  • 打赏
  • 举报
回复
给img设定 display:block。
jimu8130 2009-02-27
  • 打赏
  • 举报
回复
那你用表格来规范看看
Amy_wang 2009-02-27
  • 打赏
  • 举报
回复
代码贴出来看看

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧