HTML練習--制作一個表單


實現效果在這里插入圖片描述

通過創建表格嵌套表單實現

實現代碼

<!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>

最終效果

在這里插入圖片描述


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM