表格自适应
【摘要】 表格自适应
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<style>
table {
border: 1px solid #ccc;
width: 80%;
margin:0;
padding:0;
border-collapse: collapse;
border-spacing: 0;
margin: 0 auto;
}
table tr {
border: 1px solid #ddd;
padding: 5px;
text-align: center;
}
table th{
padding: 20px;
text-align: center;
}
table td {
padding: 10px;
text-align: center;
}
table th {
text-transform: uppercase;
font-size: 14px;
letter-spacing: 1px;
}
@media screen and (max-width: 600px) {
table {
border: 0;
}
table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
}
table td {
display: block;
text-align: right;
font-size: 13px;
border-bottom: 1px dotted #ccc;
}
table td:last-child {
border-bottom: 0;
}
table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
}
a{
text-decoration: none;
color: black;
}
</style>
<body>
<table>
<thead>
<tr>
<th><a href=""></a>昵称:</th>
<th><a href=""></a>账号</th>
<th><a href=""></a>密码</th>
<th><a href=""></a>VIP</th>
</tr>
<tr>
<th><a href=""></a>昵称:</th>
<th><a href=""></a>账号</th>
<th><a href=""></a>密码</th>
<th><a href=""></a>VIP</th>
</tr>
</thead>
<!-- <tbody>
<tr>
<td data-label="昵称">小仙</td>
<td data-label="账号">123456</td>
<td data-label="密码">123456</td>
<td data-label="VIP">03/01/2022 - 04/0/2022</td>
</tr>
</tbody> -->
</table>
</body>
</html>
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)