Page Widget How to - Config webkit-scrollbar








Question

We would like to know how to config webkit-scrollbar.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.scrollbar-container {<!--   w w w  .  j  av  a  2  s.c o m-->
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 20px;
  border: 4px solid rgba(0, 0, 0, 0.2);
  overflow: auto;
  background-color: whiteSmoke;
}

.scrollbar-container .inner {
  height: 2011px;
  width: 1985px;
  padding: 1em;
  background-color: white;
  font-family: sans-serif;
}

::-webkit-scrollbar {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border: solid whiteSmoke 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}
</style>
</head>
<body>
  <div class="scrollbar-container">
    <div class="inner">
      <p>Hi there! Nice scrollbars, aren't they?</p>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: