table表头固定表体滚动
来源:互联网 发布:数据直报系统 编辑:程序博客网 时间:2024/06/07 14:53
实际的项目中需要用到弹出框包含表格时,万一表格很长不方便显示,这时就需要滚动表格,那么怎么才能实现呢?
如下,是用纯css实现的滚动表格(但是firefox和360极速模式下存在兼容性问题,有待提高)
原理:外面一个大的div,包裹两个div>tabel,上面一个div原来模拟固定的表头,下面的div设置overflow-y:auto;
其中用到 colgroup 标签,点我了解colgroup标签的用法
<!doctype html><html><head><meta charset="utf-8"><title>纯css表头固定-jq22.com</title><script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script><style> .tableWrap { width:600px; box-sizing:border-box;}.table-thead { width:auto; font-size:14px; background-color:#FFF; border:1px solid #CFCFCF; border-collapse:collapse; border-spacing:0px;}.table-thead tr th { text-align:left; padding-left:10px; border-right:1px solid #CFCFCF;}.table-thead tr th:last-child,.table-thead tr th:nth-last-child(2) { border-right:0;}.table-thead tr,.table-tbody tr { height:35px;}.table-tbody { width:auto; font-size:14px; background-color:#FFF; border-left:1px solid #CFCFCF; border-collapse:collapse; border-spacing:0px;}.table-tbody tr { border-bottom:1px solid #CFCFCF;}.table-tbody tr td { padding-left:10px; padding-right:10px; border-right:1px solid #CFCFCF;}.comTbody { width:auto; display:inline-block; max-height:100px; overflow-y:auto; border-bottom:1px solid #CFCFCF;}</style></head><body><div class="tableWrap" style="margin:20px;"> <table class="table-thead"> <colgroup> <col width="50"> <col width="100"> <col width="150"> <col width="17"> </colgroup> <thead> <tr> <th>序号</th> <th>账户名称</th> <th>账户编号</th> <th></th> </tr> </thead> </table> <div class="comTbody"> <table class="table-tbody" style="border-top: 0;"> <colgroup> <col width="50"> <col width="100"> <col width="150"> </colgroup> <tbody> <tr> <td>1</td> <td>中国电信</td> <td>12312312313132</td> </tr> <tr> <td>1</td> <td>中国电信</td> <td>12312312313132</td> </tr> <tr> <td>1</td> <td>中国电信</td> <td>12312312313132</td> </tr> <tr> <td>1</td> <td>中国电信</td> <td>12312312313132</td> </tr> <tr> <td>1</td> <td>中国电信</td> <td>12312312313132</td> </tr> </tbody> </table> </div></div></body></html>
阅读全文
0 0
- table表头固定表体滚动
- table 表头固定,表体滚动的css方法
- HTML/CSS实现<table>表头固定、表体滚动
- GridView(table) 滚动条 固定表头、列
- 实现table表头固定 内容滚动效果
- bootstrap的table表头固定tbody滚动
- table中head表头固定,body滚动
- GridView表头固定,表体滚动效果
- table的表头固定--上下滚动表头固定,左右滚动跟随滚动
- html table表头不变滚动表体
- 【经典思维】table 表头固定,内容自由滚动
- SSRS 页面滚动条下拉时固定table表头
- table中资料过多,表头固定,清单添加滚动条
- JS(JQ)实现table表格固定表头且表头可以随横向滚动而滚动
- JS(JQ)实现table表格固定表头且表头可以随横向滚动而滚动
- css 固定table表头
- Table实现表头固定
- table表头行固定
- 多线程进阶--volatile关键字解析
- Inception 初探
- 封装、静态
- Linux 系统管理-进程管理
- 计算机系统的虚拟内存
- table表头固定表体滚动
- 光学标定 (非计算机)
- Sagheer and Nubian Market
- oralce优化
- 使用ReadPixels方法,实现对游戏截取任意位置的屏幕,以及保存和显示截取结果
- tyer
- Python 2.7.x 和 3.x 版本的重要区别
- 多态、抽象
- Android Studio gradle 文件中 ${supportLibVersion} 用法