我正在尝试使用垂直和水平滚动条以及固定标题制作可滚动表格。如何制作带有固定标题的可滚动表格
但是,当我尝试使头在固定位置,我的垂直滚动条变得隐藏,只有当我滚动极右。
同样,如果我使滚动条可见,我的标题变得可移动。
请指教。
PFB我的CSS代码。
.button-container{
text-align: center;
}
table {
border-collapse: collapse; /* make simple 1px lines borders if border defined */
}
tr {
width: 100%;`}
.outer-container {
position: absolute;
top:0;
left: 0;
right: 300px;
bottom:40px;
overflow: hidden;
}
.inner-container {
width: 100%;
height: 100%;
position: relative;
overflow-y:hidden;
}
.header-table-container {
float:left;
width: 100%;
}
.header-table{
background: #0088CC;
width=100%;
cellpadding=0;
cellspacing=0;
}
.body-table-container {
float:left;
height: 100%;
}
.body-table{
width=100%;
cellpadding=0;
cellspacing=0;
height:500px;
}
.header-cell {
background-color: yellow;
text-align: left;
height: 40px;
}
.body-cell {
background-color: blue;
text-align: left;
}
.headerCol {
width: 160px;
min-width: 160px;
text-align: center;
}
.bodyCol {
width: 160px;
min-width: 160px;
}
.resultsCol {
width: 250px;
min-width: 250px;
}
.even {
background: lightgrey;
}
.button-container{
text-align: center;
}
.results{
text-align: left;
}
#preprod-wrapper{
}
#prod-wrapper{
height:500px;
}
哪里是你的HTML?提供一个工作示例(snippet/jsfiddler/something ...) – Dekel
http://stackoverflow.com/questions/17827908/how-to-make-fixed-header-table-inside-scrollable-div和http: //stackoverflow.com/questions/673153/html-table-with-fixed-headers – SchwiftyPython