CSS 隐藏滚动条

2019-12-29  本文已影响0人  草帽lufei

css ::-webkit-scrollbar

<html>
  <head>
    <title>-webkit-scrollbar</title>
    <style type="text/css">
      .div1 {
        width:800px;height:100px;overflow-y: auto;border:1px solid #ccc;
      }
      .div2 {
        width:800px;height:100px;overflow-y: auto;border:1px solid #ccc;
      }
      .div2::-webkit-scrollbar {
        display:none;
      }
    </style>
  </head>
  <body>
    <div>
      <h2>CSS 自定义滚动条</h2>
      <div class="div1">
        <p>Falling in love with you was the easiest thing I’ve ever done.</p>
        <p>爱上你是我做过的最容易的一件事。</p>
        <p>There are all kinds of people in this world. It happens that we have become friends. This is not fate. It is just that we should be friends.</p>
        <p>这世界上有各种各样的人,恰巧我们成为了朋友,这不是缘分,仅仅只是我们本就应该是朋友。</p>
        <p>The world’s full of lonely people afraid to make the first move.</p>
        <p>这个世界每一个孤独的人都害怕迈出第一步。</p>
        <p>They don’t have a choice, but you do.</p>
        <p>他们没得选择,但你有。</p>
        <p>You never win with violence. You only win when you maintain your dignity.</p>
        <p>你永远不会以暴力取胜。只有保持尊严才能战胜一切。</p>
      </div>
      <br>
      <br>
      <br>
      <br>
      <div class="div2">
        <p>Falling in love with you was the easiest thing I’ve ever done.</p>
        <p>爱上你是我做过的最容易的一件事。</p>
        <p>There are all kinds of people in this world. It happens that we have become friends. This is not fate. It is just that we should be friends.</p>
        <p>这世界上有各种各样的人,恰巧我们成为了朋友,这不是缘分,仅仅只是我们本就应该是朋友。</p>
        <p>The world’s full of lonely people afraid to make the first move.</p>
        <p>这个世界每一个孤独的人都害怕迈出第一步。</p>
        <p>They don’t have a choice, but you do.</p>
        <p>他们没得选择,但你有。</p>
        <p>You never win with violence. You only win when you maintain your dignity.</p>
        <p>你永远不会以暴力取胜。只有保持尊严才能战胜一切。</p>
      </div>
    </div>
  </body>
</html>
上一篇下一篇

猜你喜欢

热点阅读