黑马程序员技术交流社区
标题:
响应式表格实例
[打印本页]
作者:
南国之南
时间:
2016-7-15 20:55
标题:
响应式表格实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-seale=1">
<title>模板页</title>
<style>
h1{
font-size: 30px;
text-align: center;
color: #666;
}
table.responsive{
width: 98%;
margin:0 auto;
border: 1px solid #666;
box-shadow: 0 0 10px 0 rgba(0,0,0,.5);
}
table.responsive th,table.responsive td{
border: 1px solid #666;
padding: .5em 1em;
}
table.responsive th{
background-color: #35B558;
}
table.responsive .actions a{
color:#ff5c00;
text-decoration: none;
padding:0 4px;
}
table.responsive .number,table.responsive .actions{
text-align: center;
}
@media (max-width: 480px){
table.responsive{
box-shadow: none;
border: none;
}
table.responsive thead{
display: none;
}
table.responsive tr,table.responsive td{
display: block;
border: none;
position: relative;
}
table.responsive tr{
margin-bottom: 1em;
box-shadow: 0 1px 10px 0 rgba(0,0,0,.2);
}
table.responsive .number{
background-color: #35B558;
text-align: left;
padding-left: 28%;
}
table.responsive .number::before{
content: "课程序号";
position: absolute;
left:.5em;
top: .5em;
font-weight: bold;
}
table.responsive .name{
text-align: left;
padding-left: 28%;
}
table.responsive .name::before{
content: "课程名称";
position: absolute;
left:.5em;
top: .5em;
font-weight: bold;
}
table.responsive .actions{
position: absolute;
right: 0px;
top: 0px;
}
}
</style>
</head>
<body >
<h1>学院课程</h1>
<table class="responsive">
<thead>
<tr>
<th>课程序号</th>
<th>课程名称</th>
<th>课程操作</th>
</tr>
</thead>
<tbody>
<tr>
<td class="number">150406</td>
<td class="name">移动应用开发</td>
<td class="actions">
<a href="#">修改</a> <a href="del">删除</a>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="number">150407</td>
<td class="name">Web前端开发</td>
<td class="actions">
<a href="#">修改</a> <a href="del">删除</a>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="number">150408</td>
<td class="name">UI平面设计</td>
<td class="actions">
<a href="#">修改</a> <a href="del">删除</a>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="number">150409</td>
<td class="name">深入了解AngularJS</td>
<td class="actions">
<a href="#">修改</a> <a href="del">删除</a>
</td>
</tr>
</tbody>
</table>
</body>
</html>
作者:
梦里千年
时间:
2016-7-16 08:34
好高深的样子
作者:
南国之南
时间:
2016-7-16 22:11
梦里千年 发表于 2016-7-16 08:34
好高深的样子
涉及到的东西很少,主要是都放一起了,看着就觉得有点多,其实不多
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2