首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

table居中,该如何解决

2012-05-12 
table居中怎么让table水平居中和垂直居中呢htmlheadtitle注册/titlestyle.stats1{color:#aaa}.

table居中
怎么让table水平居中和垂直居中呢

<html>
<head>
<title>注册</title>
<style>
.stats1{
color:#aaa;
}
.stats2{
color:#000;
}
.stats3{
color:red;
}
.stats4{
color:green;
}

</style>
<script src="check.js"></script>
</head>
<body>

<form action="register.php" method="post" onsubmit="return regs('click')">
<table border="1" bordercolor="#66FF66" align="center" height="400">
<tr>
<td>用户名:<input type="text" name="username" value="">
<span class="stats1">请输入用户名</span><br>
</td>
</tr>
<tr>
<td>
密码:<input type="password" name="password" value="">
<span class="stats1">请输入密码</span><br>
</td>
</tr>
<tr>
<td>
确认密码:<input type="password" name="repass" value="">
<span class="stats1">请确定密码</span><br>
</td>
</tr>
<tr>
<td>
邮箱:<input type="text" name="email" value="">
<span class="stats1">请输入邮箱</span><br>
</td>
</tr>
<tr>
<td>
其他:<input type="text" name="other" value="">
<span class="stats1">请输入其他</span><br>
</td>
</tr>
<tr>
<td>
确定:<input type="submit" name="sub" value="submit">
</td>
</tr>
</table>
</form>

</body>
</html>


[解决办法]

HTML code
<html><head><title>注册</title><style>.stats1{color:#aaa;}.stats2{color:#000;}.stats3{color:red;}.stats4{color:green;}</style><script src="check.js"></script></head><body><form action="register.php" method="post" onsubmit="return regs('click')"><table width="100%" height="100%" valign="middle"><tr><td><table border="1" bordercolor="#66FF66" align="center" height="400" valign="middle"><tr><td>用户名:<input type="text" name="username" value=""><span class="stats1">请输入用户名</span><br></td></tr><tr><td>密码:<input type="password" name="password" value=""><span class="stats1">请输入密码</span><br></td></tr><tr><td>确认密码:<input type="password" name="repass" value=""><span class="stats1">请确定密码</span><br></td></tr><tr><td>邮箱:<input type="text" name="email" value=""><span class="stats1">请输入邮箱</span><br></td></tr><tr><td>其他:<input type="text" name="other" value=""><span class="stats1">请输入其他</span><br></td></tr><tr><td>确定:<input type="submit" name="sub" value="submit"></td></tr></table></td></tr></table></form></body></html> 

热点排行