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;
    }
  }
}
相关推荐
EEEzhenliang7 小时前
CSS样式所有使用方式(书写位置)
前端·css
十六年开源服务商11 小时前
WordPress在线聊天系统推荐
大数据·javascript·html
jzlhll12312 小时前
android经常用到的一个小工具颜色计算器
html
Yan.love12 小时前
【CSS-核心属性】“高频词”速查清单
前端·css
郭优秀的笔记12 小时前
html鼠标悬浮提示功能
android·javascript·html
Yan.love13 小时前
【CSS-动画与过渡】丝滑的艺术,从简单位移到贝塞尔曲线
前端·css
Rattenking13 小时前
【CSS】---- 根据【张鑫旭-高宽不等图片固定比例布局的三重进化】的思考
前端·css
Irene199114 小时前
CSS 新特性总结(附:var() 函数详解)
css
_OP_CHEN14 小时前
【前端开发之HTML】(三)HTML 常见标签(下):图文、链接与实战,解锁网页交互新姿势!
前端·html·交互·前端开发·网页开发·界面美化