当前位置: 代码迷 >> HTML/CSS >> table居中,该如何解决
  详细解决方案

table居中,该如何解决

热度:165   发布时间:2012-05-12 15:39:31.0
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> 
  相关解决方案