CSS ::-webkit-scrollbar 不适用于 javafx 查看器



我尝试了 css 来自定义 java Swing 嵌入式 javafx 网页视图中的滚动条,我使用相同的 css 来显示两个网页,滚动条不能像 css 中那样按预期自定义,但另一个可以很好地自定义,有谁知道网页显示是否有一些限制?谢谢! Html是第三方网页:

以下是 css 脚本:

body {
overflow-y: scroll;
overflow-x: scroll;
width: 1000px;
height: 1000px;
position: absolute;
}
/* Let's get this party started */
::-webkit-scrollbar {
width: 120px !important;
height: 120px !important;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: rgba(255,0,0,0.8);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255,0,0,0.4);
}

你的滚动条CSS是正确的,但你在正文和内部HTML中放了错误的CSS。

body{display: block;  overflow: auto; height: 1000px; width: 100%; box-sizing:border-box;}
body::-webkit-scrollbar {width: 5px; height: 8px; background-color: red; }
body::-webkit-scrollbar-thumb {background: #000; }
<body> 
this just test for scroll
</body>

最新更新