简易笔记:表格 + 表单

1. 表格基础

border='1':显示边框。

cellspacing:单元格间距。

cellpadding:内容与边框的间距。

<th>:表头(加粗居中),<tr>:行,<td>:列。

2. 表单控件

文本框<input type='text'>(placeholder 是提示文字)。

密码框<input type='password'>(输入内容显示为圆点)。

单选框<input type='radio'>

互斥:必须设置相同的 name(如 name='sex')。

关联labelfor对应 inputid,点击文字也能选中。

按钮<button>(提交/重置)。

3. 结构

<form>包裹表格,用于收集数据。

举例代码块
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>表格</title>
	</head>
	<body>
	    <form action=''>
	        <table border='1' cellspacing="" cellpadding="">
	            <tr><th>Header</th><th>Header</th></tr>
	            <tr><td>用户名</td><td><input type='text' placeholder='不超过6~8个字'></input></td></tr>
	            <tr><td>密码</td><td><input type='password'></td></tr>
	            <tr>
	                <td>性别</td>
	                <td>
	                    <label for='nan'>
	                        <input type='radio' name='sex'id='nan'/>男
	                    </label>
	                    <label for='nv'>
                            <input type='radio' name='sex'id='nv'/>女
                        </label>
	                </td>
	            </tr>
	            
	            <tr><td><button>提交</button></td><td><button>重置</button></td></tr>
	        </table>
	    </form>
	</body>
</html>