侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

利用css使文字渐变 –

2022-06-01 星期三 / 0 评论 / 0 点赞 / 225 阅读 / 1859 字

[mark_c]本博客加入QQ群就是这个效果,代码来至:青找博客英文名:Qing Zhao[/mark_c]效果图HTML<div class="masked"><p>一个人真正优秀的特质来自于内心想要变得更加优秀的那种强烈的渴望,和对

[mark_c]本博客加入QQ群就是这个效果,代码来至:青找博客英文名:Qing Zhao[/mark_c]

效果图

HTML

<div class="masked"><p>一个人真正优秀的特质来自于内心想要变得更加优秀的那种强烈的渴望,和对生命的追求那种火热的激情。<br></p></div>

CSS

.masked p {  display:block;  /**width:355px;  height:50px;**/  /*渐变背景,此处为能无缝拼接的渐变 即0~100%*/   /*linear-gradient(线性渐变)*/  background-image:-webkit-linear-gradient(left,#3498db,#f47920 10%,#d71345 20%,#f7acbc 30%,#ffd400 40%,#3498db 50%,#f47920 60%,#d71345 70%,#f7acbc 80%,#ffd400 90%,#3498db);  color:transparent;  /*文字填充色为透明*/  -webkit-text-fill-color:transparent;  -webkit-background-clip:text;  /* background-clip 规定背景的绘制区域:*/   /*背景剪裁为文字,相当于用背景填充文字 CSS3新属性*/  -webkit-background-size:200% 100%;  /*背景图片向水平方向扩大一倍,这样background-position才有移动与变化的空间*/  background-size:200% 100%;  /* 动画 */  -webkit-animation:masked-animation 4s infinite linear;}@keyframes masked-animation {  0% {  background-position:0 0;  /*background-position 属性设置背景图像的起始位置。*/}100% {  background-position:-100% 0;}}@-webkit-keyframes masked-animation {  0% {  background-position:0 0;}100% {  background-position:-100% 0;}}

广告 广告

评论区