您当前的位置: 首页 >  动画

Phil Arist

暂无认证

  • 0浏览

    0关注

    276博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

如何实现文字动画效果

Phil Arist 发布时间:2022-07-05 16:07:22 ,浏览量:0

这个小项目是一个CSS实现的文字动画效果,主要就是用在页面加载时的效果,现在,我们一起来看一下这个项目的最终效果:

HTML代码:




    
    CSS实现文字动画效果


  正在加载中...

CSS代码:

{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: sans-serif;
}
body
{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #252839;
}
h1
{
    position: relative;
    font-size: 14vw;
    color: #252839;
    line-height: 1.2em;
    text-transform: uppercase;
    -webkit-text-stroke: 0.3vw #383d52;
}
h1:before
{
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    color: #01fe87;
    overflow: hidden;
    -webkit-text-stroke: 0vw #383d52;
    border-right: 4px solid #01fe87;
    animation: animate 4s linear infinite;
}
@keyframes animate
{
    0%,10%,100%
    {
        width: 0;
    }
    70%,90%
    {
        width: 100%;
    }
}

写在最后

以上就是每日一练的全部内容,希望今天的小练习对你有用

关注
打赏
1662360869
查看更多评论
立即登录/注册

微信扫码登录

0.0635s