css3特效文本填充动画

白色玫瑰 程序猿

时间: 2023-05-22 阅读: 1 字数:1993

{}
css文本描边

css3特效文本填充动效果如下 在这里插入图片描述 特殊属性: -webkit-text-stroke 是一个css属性,定义文字字符描边的宽度和颜色,它是-webkit-text-stroke-width和-webkit-text-stroke-color两个css样式的缩写。 一、text-stroke 是 text-stroke-width 和 text-stroke-color 的合体 描边宽度和描边颜色 只能实现描边,不支持点线或者虚线 二、 与border比较 对于text-stroke属性,我们无法指定描边的类型,只能是实线描边,不支持点线或者虚线,也无法指定描边是外描边还是内描边还是居中描边。 宽度的默认值不一样。border-width的默认值是medium,最终表现等同于设置3px,但是text-stroke-width的默认值确是0,这就意味着,当我们使用text-stroke属性的时候,描边宽度是必不可少的,颜色理论上可以不设置 但是由于颜色缺省的时候会使用文字的color作为描边色,导致最终的效果只是单纯的文字变得更壮实了,已然不是描边效果了

附 html

  
## 行行皆辛苦...

附css

*{
   box-sizing: border-box;
}
body{
   display: flex;
   align-items: center;
   justify-content: center;
   min-height: 100vh;
   background-color: #252839;
}
h2{
   position: relative;
   font-size: 80px;
   color: #252839;
   -webkit-text-stroke: 1px #13e01e;
}
h2::before
{
   content:'行行皆辛苦...';
   position: absolute;
   top:0;
   left:0;
   width: 0;
   height: 100%;
   color: #01fe87;
   -webkit-text-stroke: 0px #13e01e;
   border-right: 2px solid  #13e01e;
   white-space:nowrap;
   overflow: hidden;
   animation: move-border 10s linear infinite;
}
@keyframes move-border {
   0%,100%{
      width: 0;
   }
   70%{
      width: 100%;
   }
}

原文地址:https://blog.csdn.net/dream_will_true/article/details/129200946?ops_request_misc=&request_id=&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~all~koosearch~default-13-129200946-null-null.142^v87^koosearch_v1,239^v2^insert_chatgpt&utm_term=css3%E7%89%B9%E6%95%88

本文章网址:https://www.sjxi.cn/detil/b61abb5f0a784f92a2c036f4742dfddb

最新评论

当前未登陆哦
登陆后才可评论哦

湘ICP备2021009447号