.clr { clear:both; } .con { height:800px; width:100%; } /*占位符*/ .pd10 { padding:10px; position:relative; } /*table样式*/ .table { margin-top:50px; background-color:#f0f0f0; border-collapse:collapse; } .table thead { height:50px; } .table tr td,.table tr th { padding:20px; text-align:center; border:1px solid #000; } /*搜索样式*/ #header { width:100%; border-top:solid 1px #ccc; border-bottom:solid 1px #ccc; text-align:center; } .nav { width:500px; background:#fff; margin:20px auto 0; border:solid 1px #ccc; zoom:1; border-radius:5px; box-shadow:0 1px 6px rgba(0,0,0,0.1); color:#D74452; } .nav:after { content:""; display:block; height:0; clear:both; visibility:hidden; } .nav ul li { float:left; margin:0 20px; height:30px; line-height:30px; } .nav ul li a { cursor:pointer; } .nav ul li a:hover { text-decoration:underline; } .nav_scroll { position:fixed; width:100%; margin:0; left:0; top:0; }
注:为了保证'table th' 与 'td '对其,所以复制一份table放在‘<div id="table_title" style="display: none;"></div>’里,然后获取表头高度赋给‘#table_title’,同时使用‘overflow:hidden’隐藏多出来的table其余部分;