css实现图片边缘模糊效果

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
      }
      html {
        height: 100%;
      }
      body {
        height: 100%;
      }
      .avatar {
        width: 30%;
        height: 30%;
        border-radius: 200px;
        overflow: hidden;
        position: relative;
      }
      .avatar::after {
        /* 【主要代码】 */
        position: absolute;
        content: '';
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        border-radius: 200px; /* 避免四个角没有阴影 */
        box-shadow: 0 0 50px 30px #fff inset; /* 【主要代码】 */
      }
      img {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div class="avatar">
      <img src="https://images.dog.ceo/breeds/pembroke/n02113023_6519.jpg" />
    </div>
  </body>
</html>
相关推荐
GISer_Jing9 小时前
Come on,工作总结
前端·ai·前端框架
Hilaku9 小时前
Sass 和 Less 在 2026 年彻底多余了吗?
前端·javascript·程序员
右耳朵猫AI9 小时前
Node.js周刊2026W38 | 进程中断缺陷修复、Copilot 迁至 Rust、Node 新增 VFS
javascript·后端·node.js
百慕大三角9 小时前
AI 写代码最大的风险不是不会写,而是太能写:我给 Coding Agent 加的 4 层工程约束
前端·ai编程·trae
Shao2399 小时前
基于 Rokid AIUI:在眼镜上穿越五千年
javascript
用户921080262869 小时前
从 EventSource 到可复用 SSE Client:我如何实现多实例、双超时与自动重连
前端
咩咩啃树皮9 小时前
ES6 Set 核心特点 + 最简数组去重
前端·javascript·html
OpsEye9 小时前
开发者小技巧:一套API Key调用海内外多款代码大模型
javascript·ai编程
zhanghaha13149 小时前
HTML系列教程:18_HTML / CSS 颜色零基础详解
css·html·tensorflow