在Eamon Nerbonne的
solution中添加另一个div,给了我以下解决方案:
基本上解决方案是,如果你添加另一个父div来控制辅助div的流程可能会给你一个去.
1 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
2 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
3 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
4 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
5 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
6 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
7 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
8 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
9 | QWERTYUIOPASDFGHJKLZXCVBNM | QWERTYUIOPASDFGHJKLZXCVBNM |
我为外部div添加了样式,如下所示:
div.first {
width: auto;
overflow-y: scroll;
overflow-x: hidden;
height: 150px; /* this is the height that you expect to contain */
padding-bottom: 1px;
position: absolute;
left:0;
top:auto;
}