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>
相关推荐
chilavert3186 分钟前
技术演进中的开发沉思-266 Ajax:让 动画优化
javascript·ajax·okhttp
一水鉴天14 分钟前
整体设计 定稿 之 34 codybuddy项目跨机同步方案 之2 (codebuddy)
服务器·前端
朱 欢 庆14 分钟前
Jenkins任务执行完成后发送邮件
前端·经验分享·jenkins
我是伪码农15 分钟前
Tab选项卡
css·html·css3
前端无涯16 分钟前
React/Vue 消息订阅发布:实现方式、开发避坑与面试核心考点
前端·javascript·vue.js
一个没有感情的程序猿26 分钟前
前端实现交互式3D人体肌肉解剖图:基于 Three.js + React Three Fiber 的完整方案
前端·javascript·3d
武玄天宗27 分钟前
第五章、flutter怎么创建底部底部导航栏界面
前端·flutter
Goodbaibaibai28 分钟前
接口请求了两次,一次报200,一次报404
前端
chilavert31829 分钟前
技术演进中的开发沉思-268 Ajax:JSON
javascript·ajax·okhttp·json
qq_4634084231 分钟前
React Native跨平台技术在开源鸿蒙中使用WebView来加载鸿蒙应用的网页版或通过一个WebView桥接本地代码与鸿蒙应用
javascript·算法·react native·react.js·开源·list·harmonyos