zoukankan      html  css  js  c++  java
  • css滚动条样式自定义

    很简单的几行代码

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Title</title>
      <style>
        * {
          margin: 0;
          padding: 0;
        }
        .out {
          width: 600px;
          height: 600px;
          margin: 100px auto;
          overflow-y: auto;
        }
        /* 滚动条整体样式(高宽分别对应横竖滚动条的尺寸) */
        .out::-webkit-scrollbar {
          width: 5px;
          height: 5px;
        }
        /* 滚动条里面小方块 */
        .out::-webkit-scrollbar-thumb {
          border-radius: 5px;
          -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
          background: rgba(0,0,0,0.2);
        }
        /* 滚动条里面轨道 */
        .out::-webkit-scrollbar-track {
          -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
          border-radius: 0;
          background: rgba(0,0,0,0.1);
        }
      </style>
    </head>
    <body>
      <div class="out">
        <p style="height:250px;background: #ccc;">段落一</p>
        <p style="height:250px;background: #eee;">段落二</p>
        <p style="height:250px;background: #ccc;">段落三</p>
      </div>
    </body>
    </html>

    最终效果图:

  • 相关阅读:
    Bugku web web基础$_GET
    Bugku web 计算器
    Bugku web web2
    Bugku 杂项 宽带信息泄露
    Bugku 杂项 猜
    Bugku 杂项 又一张图片,还单纯吗
    Bugku 杂项 啊哒
    Bugku 杂项 眼见非实(ISCCCTF)
    Bugku 杂项 telnet
    Bugku 杂项 隐写
  • 原文地址:https://www.cnblogs.com/hcxy/p/10100955.html
Copyright © 2011-2022 走看看