当前位置:网站首页>Loading font component loading effect

Loading font component loading effect

2022-06-12 08:34:00 Pumpkin_ xiaoXuan

design sketch :

html Code :

<div class="font">Loading</div>

 css Code :

<style>
    @keyframes loading {
      0% {
        height: 100%;
      }
      100% {
        height: 0%;
      }
    }
    .font {
      position: relative;
      font-size: 30px;
      font-weight: 700;
      color: tomato;
    }
    .font::before {
      position: absolute;
      top: 0;
      left: 0;
      height: 50%;
      content: 'Loading';
      font-size: 30px;
      font-weight: 700; 
      overflow: hidden;
      color: #f0f0f0;
      animation: loading 3s linear infinite;
    }
  </style>

principle : Make the white font height gradually smaller , The overflow part is hidden , Visually, it looks like the font is gradually loaded up .

What changes is the size percentage of the height .

原网站

版权声明
本文为[Pumpkin_ xiaoXuan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203010547587108.html