【问题标题】:CSS - How to make overflow hidden on the right but not the left? [duplicate]CSS - 如何使溢出隐藏在右侧而不是左侧? [复制]
【发布时间】:2012-11-16 20:30:17
【问题描述】:

可能重复:
“overflow-x:hidden” one side only?

我有一个水平滚动的容器,当用户向左滚动并溢出时,我希望它仍然显示,但每当用户向右滚动时,我希望它隐藏。有什么建议吗?

这里有一些代码:

<div class="scroller">
    ... content
</div>

.scroller {
    overflow-x: scroll;
}

【问题讨论】:

  • 您的问题已在 stackoverflow 上回答 here

标签: jquery css scroll overflow containers


【解决方案1】:

在 div 内容总是从左到右开始,所以让你的 div position:absoluteleft:0; 然后使用 overflow-x: hidden; 这种样式只适用于左侧隐藏

.scroller {
   overflow-x: hidden;
   position:absolute;
   left:0;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 2019-11-10
    • 1970-01-01
    • 2012-02-04
    • 1970-01-01
    • 2016-09-09
    • 1970-01-01
    相关资源
    最近更新 更多