首页 > Web开发 > 详细

HTML练习--制作一个表单

时间:2021-05-18 09:15:28      阅读:19      评论:0      收藏:0      [点我收藏+]

实现效果技术分享图片

通过创建表格嵌套表单实现

实现代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form>
			<table  align="center" bgcolor="aqua">
				<tr>
					<th bgcolor="blue" colspan="2">
						欢迎注册
					</th>
				</tr>
				<tr>
					<th width="150" align="right">
						<label for="user">用户名:</label>
					</th>
					<th align="left">
						<input type="text" id="user" />
					</th>
				</tr>

				<tr>
					<th align="right">
						<label for="password">密码:</label>
					</th>
					<th align="left">
						<input type="password" id="password" />
					</th>
				</tr>

				<tr>
					<th align="right">
						性别:
					</th>
					<th align="left">
						<input type="radio" name="sex" id="男" />
						<label for="男">男</label>
						<input type="radio" name="sex" id="女" />
						<label for="女">女</label><br />
					</th>
				</tr>

				<tr>
					<th align="right">
						<label for="phone"> 电话:</label>
					</th>
					<th align="left">
					<input type="text" id="phone" />
					</th>
				</tr>
				<tr>
					<th align="right">
						职业:
					</th>
					<th align="left">
						<select>
							<option>请选择</option>
							<option>学生</option>
							<option>白领</option>
							<option>上班</option>
							<option>教师</option>
							<option>工人</option>
						</select><br />
					</th>
				</tr>

				<tr>
					<th align="right">
						爱好:
					</th>
					<th align="left">
						<input type="checkbox" id="敲代码" />
						<label for="敲代码">敲代码</label>
						<input type="checkbox" id="打游戏" />
						<label for="打游戏">打游戏</label>
						<input type="checkbox" id="唱歌" />
						<label for="唱歌">唱歌</label>
						<input type="checkbox" id="运动" />
						<label for="运动">运动</label><br />
					</th>
				</tr>
				<tr>
					<th align="right">
						地址:
					</th>
					<th align="left">
						<textarea rows="3"></textarea>
					</th>
				</tr>
				<tr>
					<th bgcolor="blue" colspan="2">
						填写完成后点击下面提交按钮提交表单
					</th>
				</tr>
				<tr>
					<th colspan="2">
						<input type="submit" />
						<input type="reset" />
					</th>
				</tr>
			</table>
		</form>
	</body>
</html>

最终效果

技术分享图片

HTML练习--制作一个表单

原文:https://www.cnblogs.com/xiaofanmi/p/14778973.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!