1、表格的使用
1)、基本使用
作用:顯示資料
<table width="500"></table>
表示單元格的盒子;
<body>
<table width="500" border="1" align="center" cellpadding="10" cellspacing="0" >
<caption>數字表格</caption>
<tr>
<th>數字</th>
</tr>
<tr>
<td align="center">123</td>
</tr>
<tr>
<td >123</td>
</tr>
</table>
</body>
caption:表示表格标題
tr:表示行
td:表示單元格
th:表示表頭單元格,使得字型自動居中加粗
align:設定在網頁中水準位置
cellpadding:設定表格内内容與邊框之間的距離
機關:像素
cellspacing:設定單元格與單元格邊框之間的距離
表格内無“列”的概念。
表格規範一般為 3參為0
樣圖
2)、合并單元格
rowspan:表示跨行合并
colspan:表示跨列合并
<body>
<table width="500" border="1" align="center" cellpadding="10" cellspacing="0" >
<caption>數字表格</caption>
<thead>
<tr>
<th colspan="3">數字</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center" colspan="2">123</td>
<td align="center">abs</td>
</tr>
<tr>
<td rowspan="2">123</td>
<td align="center">123</td>
<td align="center">abs</td>
</tr>
<tr>
<td align="center">123</td>
<td align="center">abs</td>
</tr>
</tbody>
</table>
</body>
2、表單
<body>
<table width="600" border="0" cellspacing="5" cellpadding="0" align="center">
<caption><h4>揣着上墳的心情來上班</h4></caption>
<tr>
<td>所在地區</td>
<td ><input type="text" value="帝都" maxlength="4"></td>
</tr>
<tr>
<td>密碼</td>
<td ><input type="password" ></td>
</tr>
<tr>
<td>性别</td>
<td>
男<input type="radio" name="sex">
女<input type="radio" name="sex">
不确定<input type="radio" name="sex">
</td>
</tr>
<tr>
<td>喜歡類型</td>
<td>
小鮮肉<input type="checkbox" checked="true">
老臘肉<input type="checkbox">
半男不女<input type="checkbox">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="button" value="注冊" >
<input type="submit" value="送出" >
<input type="reset" value="重置" >
<input type="image" src="error.png">
</td>
</tr>
<tr>
<td>上傳頭像</td>
<td>
<input type="file">
</td>
</tr>
</table>
</body>
1)、input屬性
type的值包含:text(單行文本輸入框)、password(密碼輸入框)、radio(單選輸入框)、checkbox(複選框)、button(普通按鈕)、submit(送出按鈕)、reset(重置按鈕)、image(圖像形式的送出按鈕)、file(檔案域);
value:input控件中的預設文本;
name:當input的type為radio時(單選框),則必須設定該屬性,并且同一組内的name的值必須相同,才可實作單選的效果;
size:input控件顯示寬度
checked: 選擇控件預設選中的項目,類似于radiobutton
maxlength:控件允許輸入的最大字數
2)、label标簽
<body>
<label >
使用者名:<input type="text">
</label>
</body>
當點選使用者名三個字的時候,光标即可直接在輸入框内出現
3)、文本域
<body>
<textarea name="文本域" id="" cols="30" rows="10"></textarea>
</body>
cols:表示可輸入列數
rows:表示可輸入行數
3、下拉菜單
<body>
<select name="" id="" >
<option value="">北京</option>
<option value="" selected="selected">天津</option>
<option value="">上海</option>
</select>
</body>
selected :表示預設選擇該選項
4、表單域
<body>
<form action="wwww.baidu.com" method="get">
使用者名:<input type="text" name="username">
<br/>
<br/>
密 碼:<input type="password" name="password">
<br>
<br>
<input type="submit" value="送出" >
<input type="reset" value="重置">
</form>
</body>
action 表示:表單域送出收集到的資料到伺服器的 url 位址。
method :送出方式 get 和 post 等等