css實現動態邊框


<html>
<title>動態的邊框</title>
<style>
  .border,
  .border::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .border {
    width: 200px;
    height: 200px;
    margin: auto;
    color: #69ca62;
    box-shadow: inset 0 0 0 1px rgba(105, 202, 98, 0.5);
  }

  .border::after {
    content: '';
    margin: -2%;
    box-shadow: inset 0 0 0 2px;
    animation: clipMe 5s linear infinite;
  }

  .border::before {
    animation-delay: -4s;
  }

  @keyframes clipMe {

    0%,
    100% {
      clip: rect(0px, 220.0px, 2px, 0px);
    }

    25% {
      clip: rect(0px, 2px, 220.0px, 0px);
    }

    50% {
      clip: rect(218.0px, 220.0px, 220.0px, 0px);
    }

    75% {
      clip: rect(0px, 220.0px, 220.0px, 218.0px);
    }
  }
</style>

<body>
  <div>
    <div class="border"></div>
  </div>
</body>
</html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM