No Arrow buttons in Scrollbar after writing webkit

2019-03-29 13:23发布

问题:

Please refer to the table here. http://www.funkkopfhoerer-test.com/vergleichstabelle-funkkopfhoerer/

I'm using Table Plugin and created a custom scrollbar on top of it. But It wasn't showing up on Safari browsers until it is enabled in Safari Browser settings. So, I wrote this Css (see below) and It is now showing up in Safari regardless of browser settings. But doing so, I can't see scrollbar arrows in Chrome and Safari.

`.wmd-view-topscroll::-webkit-scrollbar {
    -webkit-appearance: none;
}
.wmd-view-topscroll::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}
.wmd-view-topscroll::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
}`

回答1:

Here is a simple solution with css arrows.

It is only tested with Chrome:
Google Chrome, 61.0.3163.79 (Officiell version) (64 bitar) (cohort: Stable)

/* Up */
::-webkit-scrollbar-button:vertical:decrement

/* Down */
::-webkit-scrollbar-button:vertical:increment

/* Left */
::-webkit-scrollbar-button:horizontal:decrement

/* Right */
::-webkit-scrollbar-button:horizontal:increment

/* Scrollbar style for Chrome */

/* Track */
::-webkit-scrollbar
{
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track
{
  background: #303030;
  border: solid 2px rgba(33,33,33,0.5);
}


/* Thumb */
::-webkit-scrollbar-thumb
{
  background: #404040;
}

::-webkit-scrollbar-thumb:hover
{
  background: #505050;
}

::-webkit-scrollbar-thumb:active
{
  background: #404040;
}

::-webkit-scrollbar-thumb:vertical
{
  border-top: solid 2px rgba(33,33,33,0.5);
  border-bottom: solid 2px rgba(33,33,33,0.5);
}

::-webkit-scrollbar-thumb:horizontal
{
  border-right: solid 2px rgba(33,33,33,0.5);
  border-left: solid 2px rgba(33,33,33,0.5);
}


/* Buttons */
::-webkit-scrollbar-button
{
  border-style: solid;
  height: 16px;
  width: 16px;
}


/* Up */
::-webkit-scrollbar-button:vertical:decrement
{
  border-width: 0 7px 14px 7px;
  border-color: transparent transparent #404040 transparent;
}

::-webkit-scrollbar-button:vertical:decrement:hover
{
  border-color: transparent transparent #505050 transparent;
}


/* Down */
::-webkit-scrollbar-button:vertical:increment
{
  border-width: 14px 7px 0 7px;
  border-color: #404040 transparent transparent transparent;
}

::-webkit-scrollbar-button:vertical:increment:hover
{
  border-color: #505050 transparent transparent transparent;
}


/* Left */
::-webkit-scrollbar-button:horizontal:decrement
{
  border-width: 7px 14px 7px 0;
  border-color: transparent #404040 transparent transparent;
}

::-webkit-scrollbar-button:horizontal:decrement:hover
{
  border-color: transparent #505050 transparent transparent;
}


/* Right */
::-webkit-scrollbar-button:horizontal:increment
{
  border-width: 7px 0 7px 14px;
  border-color: transparent transparent transparent #404040;
}

::-webkit-scrollbar-button:horizontal:increment:hover
{
  border-color: transparent transparent transparent #505050;
}
<div style="background:#212121;color:white;width:150px;height:186px;padding:8px;font-size:22px;overflow:scroll;white-space:nowrap;">
  Sep 8, 2015<br>
  <br>
  - Support for styling<br>
  scrollbars using the<br>
  WebKit syntax is now on<br>
  the Microsoft Edge backlog<br>
  with a priority of medium.
  <br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>Lorem ipsum dolor
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>
  <br>&lt;br>Lorem ipsum dolor
  <br>&lt;br>
</div>