菜单
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

SVG 模糊效果


SVG <feGaussianBlur>

The <feGaussianBlur> filter is used to create blur effects

Sorry, your browser does not support inline SVG.

这是 SVG 代码

示例

<svg height="100" width="100" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <filter id="f1" x="0" y="0" xmlns="http://www.w3.org/2000/svg">
      <feGaussianBlur in="SourceGraphic" stdDeviation="15" />
    </filter>
  </defs>
  <rect width="90" height="90" fill="yellow" filter="url(#f1)" />
</svg>
自己动手试一试 »

代码解释

  • 元素 <filter>id 属性定义了滤镜的唯一名称。
  • The blur effect is defined with the <feGaussianBlur> element
  • The in="SourceGraphic" part defines that the effect is created for the entire element
  • The stdDeviation attribute defines the amount of the blur
  • <rect> 元素的 filter 属性将元素指向 "f1" 滤镜。

SVG <feGaussianBlur>

The stdDeviation attribute defines the amount of the blur. A higher value results in a more blurry image

Sorry, your browser does not support inline SVG.

这是 SVG 代码

示例

<svg height="100" width="100" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <filter id="f2" x="0" y="0" xmlns="http://www.w3.org/2000/svg">
      <feGaussianBlur in="SourceGraphic" stdDeviation="55" />
    </filter>
  </defs>
  <rect width="90" height="90" fill="yellow" filter="url(#f2)" />
</svg>
自己动手试一试 »

×

联系销售

如果您想将 W3Schools 服务用于教育机构、团队或企业,请发送电子邮件给我们
sales@w3schools.com

报告错误

如果您想报告错误,或想提出建议,请发送电子邮件给我们
help@w3schools.com

W3Schools 经过优化,旨在方便学习和培训。示例可能经过简化,以提高阅读和学习体验。教程、参考资料和示例会不断审查,以避免错误,但我们无法保证所有内容的完全正确性。使用 W3Schools 即表示您已阅读并接受我们的使用条款Cookie 和隐私政策

版权所有 1999-2024 Refsnes Data。保留所有权利。W3Schools 由 W3.CSS 提供支持