yemoerror 发表于 2024-12-5 11:01:54

HTML5插件毛玻璃特效

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>响应式毛玻璃效果</title>
<style>
    body, html {
      height: 100%;
      margin: 0;
      justify-content: center;
      align-items: center;
    }

    .blurred-background {
      width: 100%; /* 使用百分比使宽度响应式 */
      height:100%; /* 初始高度为0,通过padding-top技巧设置高度 */

      background-image: url('your-image-url.jpg');
      background-size: cover;
      background-position: center;
      position: relative;
      border-radius: 10px;
      overflow: hidden;
    }

    .blurred-overlay {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255, 255, 255, 0.5);
      border-radius: 10px;
      backdrop-filter: blur(9px); /* 初始模糊值,可以根据需要调整 */
    }

    /* 响应式调整模糊值(可选,使用媒体查询) */
    @media (max-width: 600px) {
      .blurred-overlay {
            backdrop-filter: blur(4px); /* 在小屏幕上减少模糊强度 */
      }
    }
</style>
</head>
<body>

<div class="blurred-background">
    <div class="blurred-overlay"></div>
</div>

</body>
</html>

页: [1]
查看完整版本: HTML5插件毛玻璃特效