chrome macOS 水平滚动条无论如何都保持隐藏状态(尽管溢出:滚动)

时间:2021-03-07 21:45:59

标签: css macos google-chrome

我试图默认为我的溢出显示水平滚动条,但在 chrome + macos 中,它似乎不起作用。在 Safari 中它工作得很好。

html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div class="container">
        content that goes brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
    </div>
</body>
</html>

父容器上的 css(通过样式内联):

display: block;
width: 100px;
overflow: scroll

截图:

enter image description here

如果我手动单击框并滑动...滚动条出现,但它不是所需的功能。

1 个答案:

答案 0 :(得分:0)

因此滚动条是操作系统和应用程序级别的设置,具体取决于您使用的内容。

在 Mac 上,我认为您可以为系统屏幕打开和关闭它们,在 chrome 上您曾经可以打开和关闭它们,但是当我去寻找设置时,我在最新版本中找不到它chrome 版本。

不幸的是,除了将 overflow: scroll 添加到 div 之外,您无法控制是否显示滚动条,即使您自己让它显示,也无法保证它会显示给您的用户.

您可以查看此视频,其中有人更改了自己的 Chrome 设置 (https://www.youtube.com/watch?v=VTLHxboMivM),但就像我说的,我只是查看了当前版本并看不到它。