1. 程式人生 > 實用技巧 >前端之HTML標籤等相關內容-51

前端之HTML標籤等相關內容-51

1.列表標籤

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>

<style>
ul {
list-style: none;
}
</style>
</head>
<body>
<!--無序列表-->
<ul>
<li>
<h2>標題欄</h2>
</li>
<li>1.秒殺</li>
<li>2.優惠券</li>
<li>3.PLUS會員</li>
</ul>
<!--無序列表-->

<!--有序列表-->
<ol>
<li>秒殺</li>
<li>優惠券</li>
<li>PLUS會員</li>
</ol>
<!--有序列表-->

<!--自定義列表-->
<dl>
<dt>智商排名</dt>
<dd>1、egon</dd>
<dd>2、lxx</dd>
<dd>3、alex</dd>
<dd>4、hxx</dd>

<dt>顏值排名</dt>
<dd>egon</dd>
<dd>lxx</dd>
<dd>hxx</dd>
<dd>alex</dd>
</dl>
<!--自定義列表-->

<!--練習題-->
<dl>
<dt>購物流程</dt>
<dd>1111</dd>
<dd>1111</dd>
<dd>1111</dd>

<dt>配送方式</dt>
<dd>1111</dd>
<dd>1111</dd>
<dd>1111</dd>

<dt>支付方式</dt>
<dd>1111</dd>
<dd>1111</dd>
<dd>1111</dd>
</dl>

<hr>
<h1>物品清單</h1>
<ul>
<li>
<h2>蔬菜</h2>
<ul>
<li>黃瓜</li>
<li>茄子</li>
<li>蘿蔔</li>
</ul>
</li>
<li>
<h2>水果</h2>
<ul>
<li>西紅柿</li>
<li>香蕉</li>
<li>蘋果</li>
</ul>
</li>
</ul>

</body>
</html>

2.table標籤

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<!--
<table border="1px" width="300px" height="300px">
<tr>
<td width="500px" height="500px">名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr>
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr>
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr>
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>


<table border="1px" align="center" width="500px" height="500px">
<tr align="center" valign="top">
<td align="left" valign="bottom">名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr align="center" valign="bottom">
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr align="right" valign="center">
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr>
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>

<table border="1px" align="center" width="500px" height="500px" cellspacing="20px" cellpadding="20px">
<tr >
<td >名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr >
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr >
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr>
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>
-->

<!--細線表格的實現方式一-->
<table border="1px" align="center" width="500px" height="500px" cellspacing="0px">
<tr>
<td>名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr>
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr>
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr>
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>
<hr>
<!--細線表格的實現方式二-->
<table bgcolor="red" border="0px" align="center" width="500px" height="500px" cellspacing="1px">
<tr bgcolor="white">
<td>名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr bgcolor="white">
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr bgcolor="white">
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr bgcolor="white">
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>
<hr>
<table border="1px" align="center" width="500px" height="500px"
style="border-collapse: collapse;border: 1px solid green">
<tr>
<td>名字</td>
<td>年齡</td>
<td>性別</td>
</tr>
<tr>
<td>egon</td>
<td>18</td>
<td>male</td>
</tr>
<tr>
<td>egon2</td>
<td>28</td>
<td>male</td>
</tr>
<tr>
<td>egon3</td>
<td>38</td>
<td>male</td>
</tr>
</table>


</body>
</html>

3.table表格合併

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<table border="1px" align="center" width="500px" height="500px"
style="border-collapse: collapse;border: 1px solid green">
<caption>老爺們培訓學員資訊統計</caption>
<thead>
<th>姓名</th>
<th>年齡</th>
<th>智商</th>
</thead>

<tbody>
<tr>
<td>艾莉克斯</td>
<td>73</td>
<td>70</td>
</tr>
<tr>
<td>egon</td>
<td>18</td>
<td>70</td>
</tr>

<tr>
<td>艾莉克斯</td>
<td>73</td>
<td>70</td>
</tr>


</tbody>

<tfoot>
<td>統計</td>
<td>43.6</td>
<td>90</td>
</tfoot>
</table>


</body>
</html>

4.form表單

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="http://127.0.0.1:8080/" method="post">
<p>
<label for="inp1">使用者名稱:</label>
<input id="inp1" type="text" name="username" placeholder="請輸入使用者名稱">
</p>

<p>
<label for="inp2">密碼:</label>
<input id="inp2" type="password" name="password" placeholder="請輸入密碼">
</p>

<p>
<input type="radio" name="gender" value="male">男
<input type="radio" name="gender" value="female" checked>女
<input type="radio" name="gender" value="null">保密
</p>

<p>
<input type="checkbox" name="hobbies" value="打籃球">打籃球
<input type="checkbox" name="hobbies" value="female" checked value="踢足球">踢足球
<input type="checkbox" name="hobbies" value="null" value="羽毛球" checked>羽毛球
</p>

<p>
<input type="text" disabled name="k" value="1111">
</p>


<p>
<textarea name="comment" id="" cols="30" rows="30" style="resize: none">
這是評論資訊
</textarea>
</p>

<p>
<select name="籍貫" size="2">
<option value="北京111">北京</option>
<option value="上海222">上海</option>
<option value="深圳333" selected>深圳</option>
</select>
</p>

<p>
<select name="籍貫">
<optgroup label="一線城市">
<option value="北京111">北京</option>
<option value="上海222">上海</option>
<option value="深圳333" selected>深圳</option>
</optgroup>
<optgroup label="二線城市">
<option value="杭州">杭州</option>
<option value="煙臺">煙臺</option>
<option value="德州" selected>德州</option>
</optgroup>
</select>
</p>
<p>
<input type="submit" value="登入">
</p>
</form>

</body>
</html>