前端消除滚动条宽度对table 表格的影响

示例地址: https://codepen.io/joshuarule/pen/rjRJog?editors=1000

示例代码:














































test
test


test 2
test 2


test 3
test 3

one two three longer
one two three longer
one two three longer
one two three longer
one two three longer
one two three longer
one two three longer



//---------------------------------------

.container {
outline: 1px solid black;
width: 20rem;
}

.table {
position: relative;
padding-top: 2rem;
background-color: blue;
}

.scrollview {
height: 10rem;
overflow: auto;
}

th {
height: 0;
line-height: 0;
padding-top: 0;
padding-bottom: 0;
color: transparent;
border: none;
white-space: nowrap;
}

td, th {
border-bottom: 1px solid #eee;
background: #ddd;
padding: .5rem;
}

你可能感兴趣的:(前端消除滚动条宽度对table 表格的影响)