CSS滚动条在Internet Explorer / FireFox / Edge中不起作用

时间:2018-05-13 11:24:40

标签: css css3

我正在使用此CSS代码来自定义滚动条样式:

::-webkit-scrollbar {
      width: 8px;
} /* this targets the default scrollbar (compulsory) */

::-webkit-scrollbar-track {
      background-color: black;
} /* the new scrollbar will have a flat appearance with the set background color */

::-webkit-scrollbar-thumb {
      background-color: #59e5f6;
      border-radius: 10px;
} /* this will style the thumb, ignoring the track */

::-webkit-scrollbar-button {
      background-color: black;
} /* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */

::-webkit-scrollbar-corner {
      background-color: black;
} /* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */

body {
    scrollbar-face-color: black;
}

它适用于Chrome,但不适用于Explorer / FireFox / Edge。

你知道如何解决这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

默认情况下,IE,Edge和Firefox不支持此功能。 这是文档的屏幕截图 https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar

enter image description here

注意:您可以使用javascript库,例如 perfect-scrollbar