先看下在IE6和IE8下两个图片的效果
IE6下
IE8下
两个按钮明显错位了,怎么解决呢?代码如下
<tr style="height:50px;">
<th></th>
<td> <asp:ImageButton ID="btnSubmit" Height="24" runat="server" ImageUrl="Resources/login_b.png" OnClientClick="return fLogin();" onclick="btnSubmit_Click" />
<input type="button" style=" margin-top:2px; height:24px;width:76px;border:0px; background:url(Resources/reset.jpg); cursor:pointer;" onclick="reset()" />
</td>
</tr>
把第二个button换成第一个按钮的形式,把样式修改下效果就可以了
不要只弄一个TD,两个TD,分别放置两个按钮.
并且, Height="24" 这种不规范的写法要摒弃掉. 指定为 Height="24px"
能看下在浏览器生成的HTML代码吗?
看一下第一个控件生成的代码,让两个样式一致
可以试用chrome+devtool或者firebug+firefox看看
margin-top:2px;
加这个CSS试试vertical-align:middle
<table width="200" border="1">
<tr style="height:50px;">
<th></th>
<td> <asp:ImageButton ID="btnSubmit" margin-top:2px; Height="24px" runat="server" ImageUrl="Resources/login_b.png" OnClientClick="return fLogin();" onclick="btnSubmit_Click" />
</td>
<td>
<input type="button" style=" margin-top:2px; height:24px;width:76px;border:0px; background:url(Resources/reset.jpg); cursor:pointer;" onclick="reset()" />
</td>
</tr>
</table>
用Div+CSS的方式布局吧 用 绝对的位置
试着把onclick="btnSubmit_Click" /> 和后面的<input type="button" 两个尖括号之间的空格、换行去掉
试过的,不行