css实现文字和边框同样的渐变色效果

话不多说,直接上代码

实现的效果

js 复制代码
<div className="button">
  <div className="box">
     <div className="title">
       渐变色文字
     </div>
   </div>
</div>
css 复制代码
.button {
   	border-radius: 20px;
    background-image: linear-gradient(105deg, #3A82FD 0%, #15C6FF 100%);
    padding: 1px;
    display: inline-block;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
  .box{
    height: 100%;
    border-radius: 20px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;

    .title{
      font-size: 12px;
      line-height: 20px;
      background: linear-gradient(102deg, #1C6CF6 0%, #15E0FF 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      text-fill-color: transparent;
    }
  }
}
相关推荐
用户298698530141 小时前
Python 实现 HTML 转纯文本:两种场景下的文档模型方案
python·html·api
java1234_小锋2 小时前
【技术专题】CSS3 网页技术 - CSS3 视觉增强
前端·css·css3
晓得迷路了3 小时前
栗子前端技术周刊第 152 期 - Rspack 2.3、TypeScript 7.1 Beta、Bun 1.4.4...
前端·javascript·css
普通人63 小时前
CSS-box-sizing-使用指南
开发语言·前端·css·1024程序员节
前端架构师-老李3 小时前
HTML与CSS基础第七课—HTML 中的a标签(跳转链接)
前端·css·html
溪语流沙1 天前
【每天一个CSS | Day41】开关三连:一套状态机,三种视觉翻译
前端·css·html5·每日一练·按钮
变与不变8061 天前
css定位布局精讲
前端·css
zhippt_10141 天前
教师做课件太耗时?AI生成PPT工具与图转PPT实测梳理
人工智能·html·powerpoint
winfredzhang1 天前
从零手写一个毛玻璃风格的页面搭建台:单文件 HTML 实现组件放置、面板磁吸与图层管理
前端·html
沫璃染墨2 天前
从零入门计算机网络系列(十一):HTTP协议进阶——从重定向原理到GET/POST与Fiddler抓包
linux·服务器·开发语言·网络·c++·tcp/ip·html