【发布时间】:2019-01-03 08:27:36
【问题描述】:
我正在尝试实现带有隐藏滚动条的Flex-layout,我已经实现了。但现在我还需要一个绝对/固定按钮,但我无法让它工作。
<style>
.root {
background-color: #fff;
display: flex;
height:100%;
}
.pane {
flex-grow: 1;
flex-shrink: 1;
display: flex;
overflow-x: hidden;
overflow-y: visible;
-ms-overflow-style: none;
height: 100%;
width: 400px;
}
.pane::-webkit-scrollbar {
display: none
}
div.pos {
position: absolute;
right: 0px;
width: 32px;
height: 32px;
background-color: #01689B;
color: #fff;
}
</style>
<div class="root">
<div class="pane">
<div class="pos">x</div>
<div style="height: 2000px">
Lorem ipsum dolor sit amet, etc etc
<br/> Lorem ipsum dolor sit amet, etc etc
<br/> Lorem ipsum dolor sit amet, etc etc
<br/> Lorem ipsum dolor sit amet, etc etc
<br/> The button should stick to the right of the text and scroll width the text;
</div>
</div>
</div>
【问题讨论】:
-
您的示例代码没有显示,滚动条仍然可见。提供重现问题的minimal reproducible example。
-
@LGSon 它适用于 Chrome。将检查它在 IE 中失败的原因并编辑问题。不要使用“运行代码 sn-p”,尽管它仅在本地运行时有效。
-
我在这里使用 Chrome,带有 sn-p,......如果它在本地工作,它没有理由在 sn-p 中也不能重现。
-
为了争论,你愿意在本地试试吗?
-
啊,是的,我已经编辑了答案,添加了高度。
标签: html css flexbox scrollbar absolute