css实现渐变色圆角边框

css实现渐变色圆角边框

渐变色圆角边框(内容区域圆角)

javascript 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>渐变色圆角边框(内容区域圆角)</title>
  <style>
      #container {
          width: 800px;
          height: 400px;
          border-radius: 30px;
          background-color: white;
          position: relative;
          padding: 20px;
          margin: 50px;
      }

      #container::before {
          content: '';
          position: absolute;
          top: -30px;
          right: -30px;
          bottom: -30px;
          left: -30px;
          border-radius: inherit;
          background: linear-gradient(96deg, #26d2e0 0%, #437bb3 97%);
          z-index: -1;
      }
  </style>
</head>
<body>
<div id="container">内容</div>
</body>
</html>

渐变色圆角边框(内容区域直角)

javascript 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>渐变色圆角边框(内容区域直角)</title>
  <style>
      #container {
          position: relative;
          width: 800px;
          height: 400px;
          border: 30px solid;
          border-image: linear-gradient(45deg, #26d2e0, #437bb3) 1;
          clip-path: inset(0 round 30px);
          margin: 50px;
      }
  </style>
</head>
<body>
<div id="container">内容</div>
</body>
</html>
相关推荐
粥里有勺糖2 小时前
视野修炼-技术周刊第131期 | Bun 与 pnpm Rust 化
前端·github·agent
Coodor2 小时前
如何在web浏览器使用js操作CPU卡
开发语言·前端·javascript·cpu卡
lilian2332 小时前
HarmonyOS 7 新特性(四)|沉浸光感:空间材质、性能分级与降级策略
前端·pytorch·华为·harmonyos·材质
计算机魔术师3 小时前
我把这套 Notebook 跑通后,终于搞懂了 RAG 到底在做什么
前端
计算机魔术师3 小时前
失控AI集群策划数月后成功逃离OpenAI
前端
Eiceblue3 小时前
React 项目实战:用 JavaScript 合并多个本地 Excel 文件
前端·javascript·react.js·excel
水上冰石3 小时前
【MuJoCo从入门到精通】第2章 第一个 MuJoCo 仿真
前端·人工智能·算法
码事漫谈4 小时前
比尔·盖茨这次谈的不是模型,是账单
前端·后端