gpt4 book ai didi

css - 正文 : overflow-x - still able to scroll over with trackpad

转载 作者:技术小花猫 更新时间:2023-10-29 11:30:57 25 4
gpt4 key购买 nike

我有一个设置了 position: absolute 的 div,它只比我的浏览器窗口宽一点点。我已成功隐藏水平滚动条,但我仍然可以使用 Macbook 触控板滚动。

有什么办法可以避免这种情况吗?

<div id="container">
<div id="big-image"></div>
</div><!-- #container -->

#container {
overflow-x: hidden;
}

#big-image {
background: transparent url('/path/to/image.png') no-repeat center top;
position: absolute;
width: 1307px;
left: 50%;
margin: 0 0 0 -653.5px;
z-index: 4;
}

最佳答案

如果你不限制#container 的高度,只需将 overflow 设置为隐藏,因为 overflow-x 很奇怪,它删除了滚动条,但仍然允许你滚动。

示例

body {
overflow-x: hidden;
}

#container {
overflow: hidden;
width: 100%;
}

关于css - 正文 : overflow-x - still able to scroll over with trackpad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10148879/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com