HTML基础教程之表单与表格的嵌套

之前制作的注册页面,几个元素的对齐是混乱的

16.png

我们可以利用表格和表单的嵌套,使得页面更加规则

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>用户注册</title>
    </head>
    <body>
        <font size="5" color="red">欢迎注册php.cn</font>
        <form name="user" method="get" action="" >
            <table>
                <tr>
                    <td>用户名:</td>
                    <td><input type="text" name="username"/></td>
                </tr>
                <tr>
                <td>密码:</td>
                <td><input type="password" name="userpwd"/></td>
                </tr>
                <tr>
                <td colspan="2" align="left"><input type="submit" value="提交信息"/></td>
                </tr>
            </table>
        </form>
    </body>
</html>

可以看出,制作这样的规整界面使用table比较复杂,在以后的使用中频率不高,更多的是使用之后要学习的DIV+CSS来实现

继续学习
||
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<font size="5" color="red">php.cn</font>
<form name="user" method="get" action="" >
<table>
<tr>
<td></td>
<td><input type="text" name="username"/></td>
</tr>
<tr>
<td></td>
<td><input type="password" name="userpwd"/></td>
</tr>
<tr>
<td colspan="2" align="left"><input type="submit" value=""/></td>
</tr>
</table>
</form>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
提交重置代码
图片放大关闭