Skip to content

子绝父相

定位盒子垂直居中

待图标输入框

右上角Badge

Banner切换

难点

  • dot激活时添加5px的边框
html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../css/base.css" />
    <style>
      .banner {
        width: 70%;
        height: 500px;
        margin: 100px auto;
        background: url(./2.jpeg) no-repeat center center;
        position: relative;
      }
      .banner .arrow {
        width: 50px;
        height: 100px;
        background-color: rgba(255, 255, 255, 0.5);
        line-height: 100px;
        text-align: center;
        position: absolute;
        top: 50%;
        margin-top: -25px;
      }
      .prev {
        left: 0;
      }
      .next {
        right: 0;
      }
      .dots {
        position: absolute;
        display: flex;
        bottom: 20px;
        right: 20px;
      }
      .dot {
        background-color: white;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        margin: 0 10px;
      }
      .dot:hover {
        box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.5);
        /* 存在抖动 */
        /* border: 5px solid black;
        box-sizing: content-box; */
      }
    </style>
  </head>
  <body>
    <div class="banner">
      <div class="arrow prev">←</div>
      <div class="arrow next">→</div>
      <div class="dots">
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
      </div>
    </div>
  </body>
</html>