我正在尝试制作一个响应式应用程序; 在较大的屏幕上,有一个div列表,您可以滚动up来查看以前的div("传统"行为).在较小的屏幕上,它显示相同的列表,但顺序相反,因此向下滚动可以看到显示了div。
我认为flexbox将是一个很棒的解决方案,它是在Chrome上。
这是HTML:
<div id="list">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
</div>
而且,CSS:
#list {
display: flex;
flex-direction: column-reverse;
height: 250px;
overflow-y: scroll;
border: 1px solid black;
}
.item {
flex: 1;
padding: 2em;
border: 1px dashed green;
}
以及显示它的小提琴:http://jsfiddle.net/jbkmy4dc/3/
在Chrome中,
list
div正确显示滚动条.但是,在Firefox和IE / Edge中,滚动条可见但被禁用。
有什么想法吗? 我是否可能缺少供应商前缀?
- 2021-1-111 #
- 2021-1-112 #
这是Firefox,Edge和IE11中的错误。
与
flex-direction: column-reverse
滚动条仅出现在Chrome中。如果您切换到
column
滚动条可在所有浏览器上使用。更多信息:
Bug 1042151 - flex-direction: column-reverse (or "flex-direction:column; justify-content:flex-end") with overflow-y: auto is not scrollable
Philip Walton / flexbugs - Column-reverse and overflow-y not scrollable
- 2021-1-113 #
由于此firefox-bug仍然存在:请注意第二个链接下 在Michael_B的答案中提供的信息,kumarharsh给出了两个纯CSS的"怪胎" 具有向下滚动的解决方法" 行为与Chrome相同.来自kumarharsh在philipwalton的flexbugs列表中的帖子:
Till then, here's some whacky workaround with 2 transforms: http://jsfiddle.net/RedDevil/qar7Lc5s/ (rotate transforms) or http://jsfiddle.net/RedDevil/0z5t6j9m/ (scale transforms - better IMO)
缺点:解决方案使用
transform
并在Firefox中的内容 滚动时失去清晰度.滚动行为也是颠倒的,或者 滚动条在错误的一侧。
相关问题
- css:Internet Explorer z-index错误?cssinternetexplorerhtmlzindex2021-01-11 07:57
- html:为什么隐藏的溢出会阻止浮动元素逃离其容器?htmlcss2021-01-12 01:28
- html:CSS属性作为SASS mixin值htmlcsspropertiessassmixins2021-01-10 13:30
- html:如何在CSS中使图像覆盖?htmlcssimagehoveropacity2021-01-09 14:54
- html:从FF的选择框中删除轮廓htmlcssfirefoxxhtml2021-01-09 15:59
作为一种解决方法,您可以在两个不同的容器之间分配容器的样式:
The outer one with the sizes, borders and overflow
The inner one with the flexbox styles
如果您希望默认情况下将其滚动到底部,则可以使用JS:滚动到div的底部?