battery css

论坛 期权论坛 脚本     
匿名技术用户   2020-12-28 16:07   11   0
html, body {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, teal, aqua);
}

.battery {
    width: 6em;
    height: 3em;
    color: midnightblue;
    border: 0.5em solid currentColor;
    border-radius: 0.2em;
    font-size: 2em;
    position: relative;
    background-image: linear-gradient(to right, whitesmoke, whitesmoke);
    background-repeat: no-repeat;
    background-size: 30% 80%;
    background-position: top 0.3em left 0.3em;
    animation: charge 5s steps(8) infinite;
}

.battery::after {
    position: absolute;
    content: '';
    width: 0.5em;
    height: 2em;
    background-color: currentColor;
    top: 0.5em;
    right: -1em;
    border-radius: 0 0.2em 0.2em 0;
}

@keyframes charge {
    from {
        background-size: 10% 80%;
    }
    
    to {
        background-size: 95% 80%;
    }
}

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP