博客列表 >3.22用CSS制作一张信息表(盒子模型)

3.22用CSS制作一张信息表(盒子模型)

潮涌学习php的博客
潮涌学习php的博客原创
2018年03月24日 02:46:13793浏览

这一节课学习了盒子模型和它的css属性。

上右下左:top,right,bottom,left

内边距:padding

外边距:margin

边框:border

圆角:border-radius:

阴影:box-shadow: 水平,垂直,扩展,颜色

3.22.jpg

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>3.22作业</title>
	<style type="text/css">
		/*给整个表格以及内部单元格加上边框*/
		table,th,td {
			border:2px solid red;
		}
		/*将所有的边框线进行折叠*/
		table{
			border-collapse:collapse;
			text-align:center; /*居中*/
			margin:20px auto;
			width:60%;
			background-image:url(images/bg.jpg);
			background-repeat:no-repeat;
			background-size:cover;
			box-shadow:3px 3px 3px #888;
		}
		table caption{
			font-size:20px;
			font-weight:bolder;
			margin-bottom:20px;
		}
		th,td{
			padding:10px;
		}
		th{
			background-color:lightgreen;
		}
		/*设置图片*/
		th img {
			width:30px;
			border-radius:50%;
			box-shadow:-2px -2px 2px #888;
		}
		.zhongwu{
			color:blue;
			font-weight:bolder;
			background-color:rgba(35,155,0,0.3);
		}
	</style>
</head>
<body>
	<table>
		<caption>课程表</caption>
		<tr>
			<th>时间</th>
			<th><img src="images/1.jpg">星期一</th>
			<th><img src="images/2.jpg" alt="">星期二</th>
			<th><img src="images/3.jpg" alt="">星期三</th>
			<th><img src="images/4.jpg" alt="">星期四</th>
			<th><img src="images/5.jpg" alt="">星期五</th>
		</tr>
		<tr>
			<th rowspan="2">上午</th>
			<td>语文</td>
			<td>英语</td>
			<td>数学</td>
			<td>英语</td>
			<td>语文</td>
		</tr>
		<tr>
			<td>语文</td>
			<td>英语</td>
			<td>数学</td>
			<td>英语</td>
			<td>语文</td>
		</tr>
		<tr>
			<td colspan="6" class="zhongwu">中午休息</td>
		</tr>
		<tr>
			<th rowspan="2">下午</th>
			<td>语文</td>
			<td>英语</td>
			<td>数学</td>
			<td>英语</td>
			<td>语文</td>
		</tr>
		<tr>
			<td>语文</td>
			<td>英语</td>
			<td>数学</td>
			<td>英语</td>
			<td>语文</td>
		</tr>
	</table>
</body>
</html>

运行实例 »

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

3.22-1.jpg

3.22-2.jpg

3.22-3.jpg

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议