- HTML code
<div id="main" style="text-align:center;background:url(Images/login.jpg) no-repeat center;height:100%; width:100%"><div id="div1" style="width: 350px;"> <table border="0" style="height:100%;width:100%"> <tr> <td align="center" valign="middle"> <ul> <li>登录账号 <input id="Text1" name="login_id" type="text" onkeydown="if(event.keyCode==13)event.keyCode=9;" style="width:160px;" /></li> <li></li> <li>登录密码 <input id="Password1" name="login_pw" type="password" onkeydown="if(event.keyCode==13){document.getElementById('Button1').click();return false;}" style="width:160px" /></li> <li></li> <li style="text-align:left;margin:10px 0 0 20%;"> <input id="Button1" type="button" runat="server" value="登 录" onserverclick="Button1_Click" onclick="if(button())"/> <input id="Button2" type="button" value="重 置" style="margin:0 0 0 10%;" /></li> </ul> </td> </tr> </table></div></div>
以上是我登陆框的相关代码,为什么我在ie8下能垂直居中的,但在ie6却不能??
我在vs2008的设计模式下看到的图也是垂直居中的!!但用浏览器浏览ie6的会在最上面,ie8的是垂直居中的。
ie8的极速模式下会在左上角,连水平居中也不行。
谁帮帮忙,主要解决ie6下垂直居中问题,极速模式下的要是也有办法解决也希望大家帮帮忙!!
------解决方案--------------------------------------------------------
ie6,ie8
- HTML code
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>无标题页</title> <style type="text/css"> html, body { height: 100%; overflow: auto; } body { padding: 0; margin: 0; } </style></head><body> <form id="form1" runat="server" style="height: 100%"> <table border="0" cellpadding="0" cellspacing="0" width="100" style="height: 100%; width: 100%;"> <tr> <td align="center" valign="middle"> <div style="width:350px;"> 垂直水平居中 </div> </td> </tr> </table> </form></body></html>