1. 您的位置:首页 > 站群资讯 >内容

群力收费站:响应式表格;表格随屏幕自适应源码怎么写?

群力收费站-屏幕

响应式表格;表格自适应;表格随屏幕自适应源码分享站群模板

1.一种简单的自适应表格制作方案,就是通过给表格的外面加了一个.table-container的标签
html:

<!DOCTYPE html><html>
<head>
..... </head>
<body>
<div class="table-container">
<table>
.... </table>
</div>
</body></html>

群力收费站-响应


css:
.table-container
{
width: 100%;
overflow-y: auto;
_overflow: auto;
margin: 0 0 1em;
}
table{border:0; border-collapse:collapse;}
table td,table th{border:1px solid #999; padding:.5em 1em}//添加IOS下滚动条.table-container::-webkit-scrollbar
{
-webkit-appearance: none;
width: 14px;
height: 14px;
}

.table-container::-webkit-scrollbar-thumb
{
border-radius: 8px;
border: 3px solid #fff;background-color群力收费站: rgba(0, 0, 0, .3);
}

1.隐藏表格
随着屏幕宽度变小而删除一些内容

@media only screen and (max-width: 800px) {#unseen table td:nth-child(2),#unseen table th:nth-child(2) {display: none;}
}

群力收费站-怎么

@media only screen and (max-width: 640px) {#unseen table td:nth-child(4),#unseen table th:nth-child(4),#unseen table td:nth-child(7),#unseen table th:nth-child(7),#unseen table td:nth-child(8),#unseen table th:nth-child(8){display: none;}
}

3.翻转滚动表格
当屏幕宽度小于800时,表格内容则会发生翻转,表头的内容会放在左边。右边则是会出现滚动,超出的隐藏。这个要求是表格比较完整,不然不是很好看。在表格的外面加个#flip-scroll
table tr td, table tr th{white-space:nowrap;}

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。如若转载,请注明出处:http://www.botadmin.cn/changjianwenti/8365.html