Blogger Information
Blog 16
fans 0
comment 1
visits 19036
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html/css基础知识第三颗--列表、表格基本元素和使用--0814
学先森的博客
Original
885 people have browsed it

1、多个段落中的内容具有关联性,应该使用列表来包装数据更合适

2、要对一组相关事物具体描述,可以使用表格标签来实现

3、代码

实例

<!doctype html>
<html>
	<head>
		<title>表格</title>
		<meta charset="utf-8">
		<style type="text/css">
			table{
				/*border-collapse:collapse;*/
				width:600px;
				text-align:center;
				margin:20px auto;
			}
			table,tr,th,td{
				border-collapse:collapse; /*折叠表格线*/
				border:1px solid #666;
			}
			table tr:first-child{ /*第一行背景色*/
				background:lightgreen; 
			}
			table tr:hover{ /*鼠标悬停改变背景色*/
				background:#eee;
				color:orange;
			}
			table a{
				padding:2px 2px;
				text-decoration:none; /*无下划线*/
				border:1px solid #888;
				border-radius:3px; /*圆角*/
				box-shadow:2px 2px 2px #eee; /*阴影*/
			}
		</style>
	</head>
	<body>
		<h2>购物清单</h2>
		<p>apple</p>
		<p>牛奶</p>
		<p>电风扇</p>
		<hr> <!-- 分割线 -->
		<ul> <!-- 无序列表 -->
			<li>apple</li>
			<li>牛奶</li>
			<li>电风扇</li>
		</ul>
		<!-- 表格 -->
		<table>
			<caption><h2>购物清单</h2></caption>
			<tr>
				<th>名称</th>
				<th>品*牌</th>
				<th>数量</th>
				<th>缩略图</th>
				<th>购*买</th>
			</tr>
			<tr>
				<td>apple</td>
				<td>金帅</td>
				<td>10个</td>
				<td><img src="images/apple.jpg" alt="apple" width="100"></td>
				<td><a href="#">点击购*买</a></td>
			</tr>
			<tr>
				<td>牛奶</td>
				<td>蒙牛</td>
				<td>一箱</td>
				<td><img src="images/milk.jpg" width="100"></td>
				<td><a href="#">点击购*买</a></td>
			</tr>
			<tr>
				<td>电风扇</td>
				<td>美的</td>
				<td>一台</td>
				<td><img src="images/fan.jpg" width="100"></td>
				<td><a href="#">点击购*买</a></td>
			</tr>
		</table>
	</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post