<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>制作表单</title>
<style>
form {width: 400px;height: 460px;padding: 20px;background-color: #f2f2f2;margin: 0px auto}
h3 {border-bottom: 1px solid #808080;line-height: 50px;margin: 0px;}
.na_pw {width: 236px;height: 18px;}
.p_name {margin-right: 80px;}
/* .gen {margin-right: 80px}
.gen1 {margin-right: 80px;} */
.text {width: 240px;height: 100px;}
.pp {float: left;}
.sub {margin-left: 80px;}
.lab_ {width: 80px;float: left;text-align: right;}
</style>
</head>
<body>
<form action="http://www.baidu.com" method="POST">
<h3>注册表单</h3>
<p class="p_name">
<label for="1" class="lab_">姓名:</label>
<input type="text" name="username" id="1" class="na_pw">
</p>
<p>
<label for="2" class="lab_">密码:</label>
<input type="password" name="pawd" id="2" class="na_pw">
</p>
<p>
<label for="3" class="lab_">性别:</label>
<input type="radio" name="gender" id="3" class="gen">男
<input type="radio" name="gender" id="3" class="gen1">女
</p>
<p>
<label for="4" class="lab_">爱好:</label>
<input type="checkbox" name="hobby" id="4">唱歌
<input type="checkbox" name="hobby" id="4">跑步
<input type="checkbox" name="hobby" id="4">游泳
</p>
<p>
<label for="5" class="lab_">照片:</label>
<input type="file" name="photo" id="5">
</p>
<p>
<label for="6" class="pp" class="lab_">个人描述:</label>
<textarea name="描述" id="6" cols="30" rows="10" class="text"></textarea>
</p>
<p>
<label for="7" class="lab_">籍贯:</label>
<select name="籍贯" id="7">
<option value="1">北京</option>
<option value="2">上海</option>
<option value="3">深圳</option>
<option value="4">杭州</option>
</select>
</p>
<p>
<input type="submit" name="submit" id="8" class="sub">
<input type="reset">
</p>
</form>
</body>
</html>
HTML表单小练习
最新推荐文章于 2024-07-11 17:51:07 发布