{"id":9986,"date":"2021-07-11T00:32:50","date_gmt":"2021-07-10T16:32:50","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9986"},"modified":"2021-07-11T00:32:50","modified_gmt":"2021-07-10T16:32:50","slug":"svg-filter-shadow-css-blur","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2021\/07\/svg-filter-shadow-css-blur\/","title":{"rendered":"\u501f\u52a9SVG\u6ee4\u955c\u5b9e\u73b0CSS\u65e0\u6cd5\u5b9e\u73b0\u7684\u9634\u5f71\u548c\u6a21\u7cca\u6548\u679c"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9986\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9986<\/a><br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202107-svg-shadow.jpg';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/blur-shadow-cover.jpg\" width=\"480\" height=\"312\" alt=\"SVG\u6ee4\u955c\u4e0e\u6a21\u7cca\u548c\u6295\u5f71\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u524d\u8a00<\/h3>\n<p>\u867d\u7136CSS\u4e2d\u6709<code>box-shadow<\/code>\u5b9e\u73b0\u76d2\u9634\u5f71\uff0c<code>drop-shadow()<\/code>\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u6295\u5f71\u6548\u679c\uff0c<code>filter<\/code>\u6ee4\u955c\u6216\u8005<code>backdrop-filter<\/code>\u80cc\u666f\u6ee4\u955c\u5b9e\u73b0\u9ad8\u65af\u6a21\u7cca\u6548\u679c\uff0c\u4f46\u662f\u4f9d\u7136\u5b58\u5728\u67d0\u4e9b\u573a\u666f\uff0cCSS\u662f\u65e0\u80fd\u4e3a\u529b\u7684\u3002<\/p>\n<p>\u6b64\u65f6\uff0c\u53ef\u80fd\u9700\u8981\u501f\u52a9SVG\u6ee4\u955c\u201c\u66f2\u7ebf\u6551\u56fd\u201d\u3002<\/p>\n<p>\u672c\u6587\u5c31\u901a\u8fc7\u51e0\u4e2a\u6848\u4f8b\uff0c\u4ecb\u7ecd\u4e0bSVG\u6ee4\u955c\u5b9e\u73b0CSS\u65e0\u6cd5\u5b9e\u73b0\u7684\u9634\u5f71\u548c\u6a21\u7cca\u6548\u679c\u3002<\/p>\n<h3>\u4e8c\u3001&lt;img&gt;\u5143\u7d20\u7684\u5185\u9634\u5f71<\/h3>\n<p>\u4f8b\u5982\uff0c\u6709\u4e00\u4e2a\u56fe\u7247\u5143\u7d20\uff0c\u5176\u56fe\u50cf\u662f\u4e00\u4e2aPNG\u900f\u660e\u56fe\u3002<\/p>\n<p>\u7a0d\u7b49\uff0c\u8ba9\u6211\u627e\u4e00\u4e2a\u80fd\u4ee3\u8868\u6211\u7684\u65e0\u7248\u6743PNG\u7d20\u6750\u56fe\u3002<\/p>\n<p>10\u5206\u949f\u540e\u2026\u2026<\/p>\n<p>\u5c31\u8fd9\u5f20\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/icon-fish.png\" width=\"240\" height=\"122\" alt=\"\u9c7c\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>filter<\/code>\u6ee4\u955c\u4e2d\u7684<code>drop-shadow()<\/code>\u51fd\u6570\u8f7b\u677e\u5b9e\u73b0\u6295\u5f71\u6548\u679c\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>&lt;img src=\"fish.png\" class=\"shadow\"&gt;<\/pre>\n<pre>.shadow {\r\n    filter: drop-shadow(2px 2px 6px #000a);\r\n}<\/pre>\n<p>\u6548\u679c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_205336.png\" width=\"274\" height=\"154\" alt=\"\u6295\u5f71\u6548\u679c\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u4f46\u662f\uff0c\u5982\u679c\u60f3\u8981\u5b9e\u73b0\u4e0b\u56fe\u6240\u793a\u7684\u5185\u6295\u5f71\u6548\u679c\uff0c\u5219CSS\u5c31\u65e0\u80fd\u4e3a\u529b\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_211435.png\" width=\"254\" height=\"134\" alt=\"\u5185\u6295\u5f71\u6548\u679c\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u56e0\u4e3a<code>drop-shadow()<\/code>\u51fd\u6570\u5e76\u6ca1\u6709\u5185\u6295\u5f71\u7684\u8bed\u6cd5\uff0c\u8981\u60f3\u5b9e\u73b0\u4e0a\u56fe\u6240\u793a\u7684\u6548\u679c\uff0c\u552f\u6709\u8ba9\u56fe\u50cf\u9542\u7a7a\u8fdb\u884c\u6a21\u62df\uff0c\u4f46\u662f\u8fd9\u6837\u7684\u5904\u7406\u6210\u672c\u6bd4\u8f83\u9ad8\uff0c\u56e0\u4e3a\u9700\u8981\u5bf9\u7d20\u6750\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p>\u6b64\u65f6\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u4f7f\u7528SVG\u6ee4\u955c\u5b9e\u73b0PNG\u56fe\u50cf\u7684\u5185\u6295\u5f71\u6548\u679c\u3002<\/p>\n<p>SVG\u4ee3\u7801\u5982\u4e0b\uff08\u590d\u5236\u5230\u9875\u9762\u7684\u4efb\u610f\u95ee\u9898\uff09\uff1a<\/p>\n<pre>&lt;svg width=\"300\" height=\"300\" viewBox=\"0 0 20 20\" style=\"position:absolute;left:-999px;\"&gt;\r\n  &lt;filter id=\"inset-shadow\"&gt;\r\n    <span style=\"color:green;\">&lt;!-- \u6295\u5f71\u504f\u79fb --&gt;<\/span>\r\n    &lt;feOffset dx=\"0\" dy=\"0\"\/&gt;\r\n    <span style=\"color:green;\">&lt;!-- \u6295\u5f71\u6a21\u7cca --&gt;<\/span>\r\n    &lt;feGaussianBlur stdDeviation=\"6\" result=\"offset-blur\"\/&gt;\r\n    <span style=\"color:green;\">&lt;!-- \u53cd\u8f6c\u6295\u5f71\u4f7f\u5176\u53d8\u6210\u5185\u6295\u5f71 --&gt;<\/span>\r\n    &lt;feComposite operator=\"out\" in=\"SourceGraphic\" in2=\"offset-blur\" result=\"inverse\"\/&gt;\r\n    <span style=\"color:green;\">&lt;!-- \u5185\u6295\u5f71\u9644\u52a0\u9ed1\u8272 --&gt;<\/span>\r\n    &lt;feFlood flood-color=\"black\" flood-opacity=\".95\" result=\"color\"\/&gt;\r\n    &lt;feComposite operator=\"in\" in=\"color\" in2=\"inverse\" result=\"shadow\"\/&gt;\r\n    <span style=\"color:green;\">&lt;!-- \u628a\u5185\u6295\u5f71\u663e\u793a\u5728\u56fe\u50cf\u4e0a --&gt;<\/span>\r\n    &lt;feComposite operator=\"over\" in=\"shadow\" in2=\"SourceGraphic\"\/&gt; \r\n  &lt;\/filter&gt;\r\n&lt;\/svg&gt;<\/pre>\n<p>\u6b64\u65f6\uff0c\u53ea\u9700\u8981\u4e0b\u9762\u4e00\u884cCSS\u5c31\u53ef\u4ee5\u5b9e\u73b0PNG\u56fe\u50cf\u7684\u5185\u6295\u5f71\u6548\u679c\u4e86\u3002<\/p>\n<pre>img {\r\n    filter: url(#inset-shadow);\r\n}<\/pre>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202107\/img-inner-shadow-demo.php\" rel=\"noopener\" target=\"_blank\">IMG\u56fe\u50cf\u7684\u5185\u9634\u5f71\u5b9e\u73b0demo<\/a><\/p>\n<p><span class=\"hidden\">\/\/zxx: \u5982\u679c\u4f60\u770b\u5230\u8fd9\u6bb5\u6587\u5b57\uff0c\u8bf4\u660e\u4f60\u73b0\u5728\u8bbf\u95ee\u662f\u4f53\u9a8c\u7cdf\u7cd5\u7684\u5783\u573e\u76d7\u7248\u7f51\u7ad9\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95ee\u539f\u6587\u83b7\u5f97\u5f88\u597d\u7684\u4f53\u9a8c\uff1ahttps:\/\/www.zhangxinxu.com\/wordpress\/?p=9986\uff08\u4f5c\u8005\u5f20\u946b\u65ed\uff09<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_212511.png\" width=\"334\" height=\"446\" alt=\"demo\u9875\u9762\u6548\u679c\u622a\u56fe\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e8c\u3001\u539f\u7406\u7b80\u5355\u4ecb\u7ecd\u4e0b<\/h3>\n<p>SVG\u6ee4\u955c\uff0c\u6211\u4e4b\u524d\u4ecb\u7ecd\u8fc72\u4e2a\u6bd4\u8f83\u6df1\u5165\u7684\uff0c\u4e00\u4e2a\u662f<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2017\/12\/understand-svg-fedisplacementmap-filter\/\">feDisplacementMap\u6ee4\u955c<\/a>\uff0c\u8fd8\u6709\u4e00\u4e2a\u662f<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/10\/svg-feturbulence\/\">feTurbulence\u6ee4\u955c<\/a>\u3002<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u6ee4\u955c\u8981\u6bd4\u4e0a\u97622\u4e2a\u6ee4\u955c\u57fa\u7840\uff0c\u4e5f\u66f4\u7b80\u5355\u3002<\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ol>\n<li>\n\u4e0b\u9762\u7684\u8868\u793a\u6295\u5f71\u504f\u79fb\uff0c\u8fd9\u91cc\u6ca1\u6709\u4efb\u4f55\u504f\u79fb\u8bbe\u7f6e\u3002<\/p>\n<pre>&lt;feOffset dx=\"0\" dy=\"0\"\/&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/icon-fish.png\" width=\"240\" height=\"122\" alt=\"\u9c7c\" class=\"alignnone size-medium\" \/><\/li>\n<li>\u4e0b\u9762\u8fd9\u6bb5SVG\u4ee3\u7801\u4f5c\u7528\u662f\u6784\u5efa\u9ad8\u65af\u6a21\u7cca\uff0c\n<pre>&lt;feGaussianBlur stdDeviation=\"6\" result=\"offset-blur\"\/&gt;<\/pre>\n<p>\u5176\u4e2dstdDeviation\u8868\u793a\u6807\u51c6\u504f\u5dee\uff0c<code>result<\/code>\u5c5e\u6027\u503c\u662f\u81ea\u5df1\u5b9a\u4e49\u7684\uff0c\u76f8\u540c\u4e8e\u628a\u7ed3\u679c\u8f93\u51fa\uff0c\u7136\u540e\u7ed9\u5176\u4ed6\u6ee4\u955c\u4f7f\u7528\u3002<\/p>\n<p>\u4f1a\u6709\u4e0b\u56fe\u6240\u793a\u7684\u6548\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_214842.png\" width=\"264\" height=\"149\" alt=\"\u9ad8\u65af\u6a21\u7cca\u6548\u679c\" class=\"alignnone size-medium\" \/>\n<\/li>\n<li>\u4e0b\u9762\u8fd9\u6bb5SVG\u662f\u5b9e\u73b0\u7684\u7cbe\u534e\u6240\u5728\uff1a\n<pre>&lt;feComposite operator=\"out\" in=\"SourceGraphic\" in2=\"offset-blur\" result=\"inverse\"\/&gt;<\/pre>\n<p>\u5176\u4e2dfeComposite\u8868\u793a\u6df7\u5408\u6ee4\u955c\uff0c\u901a\u5e38\u7528\u6765\u5b9e\u73b0\u6548\u679c\u7684\u6df7\u5408\uff0c<code>operator<\/code>\u8868\u793a\u6df7\u5408\u6a21\u5f0f\u7684\u64cd\u4f5c\u662f\u54ea\u4e2a\uff0c\u652f\u6301\u4e0b\u9762\u8fd9\u4e9b\u5c5e\u6027\u503c\uff1a<\/p>\n<pre>over | in | out | atop | xor | lighter | arithmetic<\/pre>\n<p>\u5982\u679c\u5927\u5bb6\u719f\u6089CSS\u7684\u6df7\u5408\u6a21\u5f0f\uff0c\u6216\u8005\u662f\u719f\u6089canvas\u4e2d\u7684globalCompositeOperation\u5c5e\u6027\uff0c\u4e0a\u9762\u51e0\u4e2a\u503c\u5c31\u4e0d\u96be\u7406\u89e3\u3002<\/p>\n<p><code>operator=\"out\"<\/code>\u8868\u793a\u539f\u59cb\u56fe\u50cf\u548c\u9ad8\u65af\u6a21\u7cca\u91cd\u53e0\u7684\u4f4d\u7f6e\u662f\u900f\u660e\u7684\uff0c\u4e8e\u662f\uff0c\u6df7\u5408\u7684\u7ed3\u679c\u5c31\u662f\uff0c\u539f\u59cb\u56fe\u50cf\u53ea\u6709\u8fb9\u7f18\u9ad8\u65af\u6a21\u7cca\u7684\u533a\u57df\u663e\u793a\uff0c\u5c31\u6709\u4e0b\u56fe\u6240\u793a\u7684\u6548\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_215759.png\" width=\"257\" height=\"141\" alt=\"source-out\u6a21\u5f0f\u6df7\u5408\u540e\u7684\u6548\u679c\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u662f\u4e0d\u662f\u5c31\u662f\u5185\u6295\u5f71\u6548\u679c\u4e86\uff1f\n<\/li>\n<li>\u7136\u800c\uff0c\u4e0a\u9762\u7684\u5185\u6295\u5f71\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u989c\u8272\uff0c\u539f\u59cb\u56fe\u662f\u571f\u9ec4\u8272\u7684\uff0c\u8fd9\u5185\u6295\u5f71\u4e5f\u662f\u571f\u9ec4\u8272\u7684\uff0c\u6839\u672c\u5c31\u770b\u4e0d\u51fa\u6765\u6295\u5f71\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u628a\u5185\u6295\u5f71\u53d8\u4e2a\u8272\uff0c\u53d8\u6210\u9ed1\u8272\u3002\u8fd9\u4e2a\u4f7f\u7528\u7684\u5c31\u662ffeFlood\u6ee4\u955c\u3002\n<pre>&lt;feFlood flood-color=\"black\" flood-opacity=\".95\" result=\"color\"\/&gt;<\/pre>\n<p>feFlood\u6ee4\u955c\u8be5\u6ee4\u955c\u7528flood-color\u5143\u7d20\u5b9a\u4e49\u7684\u989c\u8272\u548cflood-opacity\u5143\u7d20\u5b9a\u4e49\u7684\u4e0d\u900f\u660e\u5ea6\u586b\u5145\u4e86\u6ee4\u955c\u5b50\u533a\u57df\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5448\u73b0\u7684\u5c31\u662f\u4e00\u4e2a\u8272\u5757\uff1a<\/p>\n<p><canvas width=\"264\" height=\"149\" style=\"background:black;opacity:0.95;\"><\/canvas>\n<\/li>\n<li>\u63a5\u4e0b\u6765\uff0c\u53ea\u9700\u8981\u628a\u8fd9\u4e2a\u9ed1\u8272\u8272\u5757\u548c\u571f\u9ec4\u8272\u5185\u6295\u5f71\u8fdb\u884c\u6df7\u5408\u5c31\u597d\u4e86\uff0c\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528source-in\u6a21\u5f0f\uff0c\u4e5f\u5c31\u662f\u91cd\u53e0\u7684\u5730\u65b9\u6df7\u5408\uff0c\u4e0d\u91cd\u53e0\u7684\u5730\u65b9\u900f\u660e\u3002\n<pre>&lt;feComposite operator=\"in\" in=\"color\" in2=\"inverse\" result=\"shadow\"\/&gt;<\/pre>\n<p>\u6b64\u65f6\uff0c\u5185\u9634\u5f71\u989c\u8272\u5c31\u662f\u9ed1\u8272\u4e86\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_220529.png\" width=\"252\" height=\"134\" alt=\"\u9ed1\u8272\u5185\u9634\u5f71\u6548\u679c\u622a\u56fe\u793a\u610f\" class=\"alignnone size-medium\" \/><\/li>\n<li>\u81f3\u6b64\uff0c\u4e07\u91cc\u957f\u5f81\u53ea\u5269\u6700\u540e\u4e00\u91cc\u8def\u4e86\uff0c\u90a3\u5c31\u662f\u628a\u4e0a\u9762\u7684\u9ed1\u8272\u5185\u9634\u5f71\u53e0\u52a0\u5728\u539f\u59cb\u8d44\u6e90\u4e0a\uff0c\u76f8\u5173SVG\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a\n<pre>&lt;feComposite operator=\"over\" in=\"shadow\" in2=\"SourceGraphic\"\/&gt; <\/pre>\n<p><code>operator=\"over\"<\/code>\u8868\u793a\u76f4\u63a5\u8986\u76d6\u5728\u4e0a\u9762\uff0c<code>in<\/code>\u8868\u793a\u5728\u4e0a\u9762\u7684\u8f93\u5165\u8d44\u6e90\uff0c<code>in2<\/code>\u8868\u793a\u5728\u4e0b\u9762\u7684\u8f93\u5165\u8d44\u6e90\uff0cSourceGraphic\u8868\u793a\u5e94\u7528\u6ee4\u955c\u7684\u8d44\u6e90\u56fe\u5f62\uff0c\u5728\u672c\u4f8b\u4e2d\uff0c\u5c31\u662f\u571f\u9ec4\u8272\u7684\u9c7cPNG\u56fe\u3002<\/p>\n<p>\u4e8e\u662f\u5c31\u5f97\u5230\u4e86\u6700\u7ec8\u7684\u6548\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_211435.png\" width=\"254\" height=\"134\" alt=\"\u6700\u7ec8\u5b9e\u73b0\u6548\u679c\u793a\u610f\" class=\"alignnone size-medium\" \/>\n<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6574\u4e2aSVG\u6ee4\u955c\u5b9e\u73b0\u7684\u539f\u7406\u3002<\/p>\n<h3>\u4e09\u3001Firefox\u4e0b\u80cc\u666f\u9ad8\u65af\u6a21\u7cca<\/h3>\n<p>\u8fd9\u4e2a\u6848\u4f8b\u6e90\u81ea\u201c\u4eac\u65af\u201d\u7684\u201c<a href=\"https:\/\/chaoli.club\/index.php\/5347\" rel=\"noopener nofollow\" target=\"_blank\">\u5728\u7f51\u9875\u4e2d\u5b9e\u73b0\u6807\u9898\u680f\u300c\u6bdb\u73bb\u7483\u300d\u6548\u679c<\/a>\u201d\u4e00\u6587\u3002<\/p>\n<p>\u5c0f\u4f19\u5b50\u5fae\u4fe1\u627e\u5230\u6211\uff0c\u5e0c\u671b\u6211\u53ef\u4ee5\u5e2e\u5fd9\u4f20\u64ad\u4e0b\u8fd9\u79cd\u5b9e\u73b0\u3002<\/p>\n<p>\u6211\u5462\uff0c\u5fd9\u7740\u505a\u4e9b\u5176\u4ed6\u4e0d\u52a1\u6b63\u4e1a\u7684\u4e8b\u60c5\uff0c\u4e00\u76f4\u62d6\u5230\u73b0\u5728\uff0c\u62b1\u6b49\uff0c\u62b1\u6b49\u3002<\/p>\n<p>\u5173\u4e8e\u6bdb\u73bb\u7483\u6548\u679c\uff0c\u4e4b\u524d\u6211\u6709\u4ecb\u7ecd\u8fc7\uff0c\u5c31\u662f\u4f7f\u7528<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2019\/11\/css-backdrop-filter\/\">CSS backdrop-filter\u5b9e\u73b0\u6bdb\u73bb\u7483\u6548\u679c<\/a>\u3002<\/p>\n<p>\u5b9e\u73b0\u867d\u7136\u7b80\u5355\uff0c\u4f46\u662fFirefox\u6d4f\u89c8\u5668\u9ed8\u8ba4\u5e76\u4e0d\u652f\u6301\uff0c\u9700\u8981\u5f00\u542f\u652f\u6301\u5b9e\u9a8c\u6027\u8d28\u5c5e\u6027\uff0c\u666e\u901a\u7528\u6237\u54ea\u61c2\u8fd9\u4e2a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/2021-07-10_225658.png\" width=\"559\" height=\"286\" alt=\"Firefox\u4e0e\u80cc\u666f\u6ee4\u955c\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u6b64\u65f6\uff0c\u5c31\u53ef\u4ee5\u501f\u52a9SVG\u6ee4\u955c\u8ba9Firefox\u6d4f\u89c8\u5668\u4e0b\u4e5f\u6709\u6bdb\u73bb\u7483\u6548\u679c\u3002<\/p>\n<p>\u6b64\u6ee4\u955cSVG\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;svg width=\"0\" height=\"0\" style=\"position:absolute;\"&gt;\r\n    &lt;filter id=\"blur\" color-interpolation-filters=\"sRGB\"&gt;\r\n      &lt;feGaussianBlur stdDeviation=\"6\" edgeMode=\"duplicate\"\/&gt;\r\n      &lt;feComponentTransfer&gt;\r\n          &lt;feFuncA type=\"discrete\" tableValues=\"0 1\"\/&gt;\r\n      &lt;\/feComponentTransfer&gt;\r\n    &lt;\/filter&gt;\r\n&lt;\/svg&gt;<\/pre>\n<p>feComponentTransfer\u6ee4\u955c\u8fd9\u91cc\u53ea\u8981\u662f\u9510\u5316\u8fb9\u7f18\uff0c\u4e0d\u8fc7\u5374\u4f1a\u4ea7\u751f\u5706\u89d2\uff0c\u4e0d\u8fc7\u4e0d\u4ed4\u7ec6\u770b\u4e5f\u6ce8\u610f\u4e0d\u5230\u3002<\/p>\n<p>\u76f8\u5173\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff0cCSS\u90e8\u5206\uff1a<\/p>\n<pre>.blur {\r\n    background: -moz-element(#main) no-repeat;\r\n    filter: url(#blur);\r\n}<\/pre>\n<p>\u8fd9\u91cc\u4f7f\u7528\u4e86\u4e00\u4e2aFirefix\u6d4f\u89c8\u5668\u4e13\u5c5e\u7684<code>&lt;image&gt;<\/code>\u6570\u636e\u7c7b\u578b<code>element()<\/code>\u51fd\u6570\uff0c\u8fd9\u4e2a\u51fd\u6570\u621110\u5e74\u524d\u5c31\u4ecb\u7ecd\u4e86\uff0c\u657410\u5e74\uff0c\u6709\u5174\u8da3\u53ef\u4ee5<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=1758\">\u8bbf\u95ee\u8fd9\u91cc<\/a>\u4e86\u89e3\u3002<\/p>\n<p>\u53ef\u4ee5\u8ba9\u5143\u7d20\u4f5c\u4e3a\u80cc\u666f\u56fe\u5448\u73b0\uff0c\u518d\u914d\u5408\u6a21\u7cca\u6ee4\u955c\uff0c\u5c31\u6709\u4e86\u80cc\u666f\u9ad8\u65af\u6a21\u7cca\uff0c\u4e5f\u5c31\u662f\u6bdb\u73bb\u7483\u6548\u679c\u4e86\u3002<\/p>\n<p>\u5bf9\u4e8e\u8fd9\u4e2a\u6848\u4f8b\uff0c\u6211\u4e13\u95e8\u505a\u4e86\u4e2ademo\u9875\u9762\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202107\/svg-backdrop-filter-blur-demo.php\" rel=\"noopener\" target=\"_blank\">SVG\u6ee4\u955c\u5b9e\u73b0\u80cc\u666f\u6bdb\u73bb\u7483demo<\/a><\/p>\n<p>Firefox\u548cChrome\u4e0b\u5747\u6709\u6548\u679c\uff0cChrome\u6d4f\u89c8\u5668\u662f<code>backdrop-filter<\/code>\u6ee4\u955c\u5b9e\u73b0\u7684\uff0cFirefox\u5c31\u662fSVG\u6ee4\u955c\uff0c\u53ef\u80fd\u6709\u4eba\u624b\u5934\u6ca1\u6709Firefox\u6d4f\u89c8\u5668\uff0c\u4e5f\u53ef\u4ee5\u67e5\u770b\u4e0b\u9762\u8fd9\u4e2a\u6211\u5f55\u5236\u7684MP4\u89c6\u9891\uff08\u4e0d\u52a8\u70b9\u51fb\u64ad\u653e\uff09\uff1a<\/p>\n<p><video src='\/\/image.zhangxinxu.com\/video\/blog\/202107\/back-blur.mp4' type=\"video\/mp4\" width=\"778\" height=\"424\" preload=\"auto\" autoplay autobuffer loop x-webkit-airplay=\"allow\" x5-video-player-type=\"h5\" x5-video-player-fullscreen=\"true\" x5-video-orientation=\"portraint\" webkit-playsinline=\"true\" playsinline=\"true\" \u200b\u200b\u200b\u200bposter=\"\/\/image.zhangxinxu.com\/image\/blog\/201806\/poster.png\"><\/video><\/p>\n<h3>\u56db\u3001\u8fd8\u662f\u5199\u6280\u672f\u6587\u7ae0\u7701\u5fc3<\/h3>\n<p>\u8fd8\u662f\u5199\u6280\u672f\u6587\u7ae0\u7701\u5fc3\uff0c\u6ca1\u6709\u4ec0\u4e48\u9650\u5236\uff0c\u81ea\u7531\u81ea\u5728\uff0c\u4e0d\u7528\u987e\u5fcc\u4ec0\u4e48\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u4e0b\u534a\u5e74\u4e1a\u4f59\u65f6\u95f4\u91cd\u5fc3\u8fd8\u662f\u653e\u5728\u6280\u672f\u6587\u7ae0\u7684\u66f4\u65b0\u4e0a\u5427\uff0c\u4e00\u4e9b\u4e0d\u52a1\u6b63\u4e1a\u7684\u4e8b\u60c5\uff0c\u7b49\u4ee5\u540e\u9000\u4f11\u4e86\u518d\u8bf4\u5427\u3002<\/p>\n<p>\u611f\u8c22\u5927\u5bb6\u7684\u9605\u8bfb\uff0c\u5982\u679c\u89c9\u5f97\u5185\u5bb9\u8fd8\u4e0d\u9519\uff0c\u6b22\u8fce\u5206\u4eab\u4e0e\u8f6c\u53d1\u3002<\/p>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<ul>\n<li><a href=\"https:\/\/css-tricks.com\/adding-shadows-to-svg-icons-with-css-and-svg-filters\/\" rel=\"noopener\" target=\"_blank\">Adding Shadows to SVG Icons With CSS and SVG Filters<\/a><\/li>\n<li><a href=\"https:\/\/chaoli.club\/index.php\/5347\" rel=\"noopener nofollow\" target=\"_blank\">\u5728\u7f51\u9875\u4e2d\u5b9e\u73b0\u6807\u9898\u680f\u300c\u6bdb\u73bb\u7483\u300d\u6548\u679c<\/a><\/li>\n<\/ul>\n<p>\u8bdd\u8bf4\uff0c\u4eca\u5e74\u7684\u6843\u5b50\u597d\u50cf\u7279\u522b\u597d\u5403\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f60c.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9986\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9986<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202107\/blur-shadow-cover.jpg\" width=\"160\" height=\"104\" alt=\"SVG\u6ee4\u955c\u4e0e\u6a21\u7cca\u548c\u6295\u5f71\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u867d\u7136CSS\u4e2d\u6709\u4e13\u95e8\u5b9e\u73b0\u6295\u5f71\u6216\u8005\u6a21\u7cca\u6548\u679c\u7684CSS\u5c5e\u6027\uff0c\u4f46\u662f\u7531\u4e8e\u8bed\u6cd5\u9650\u5236\u4ee5\u53ca\u517c\u5bb9\u6027\u9650\u5236\u7b49\u539f\u56e0\uff0c\u8fd9\u4e9bCSS\u5e76\u4e0d\u80fd\u8986\u76d6\u6240\u6709\u6548\u679c\uff0c\u6b64\u65f6\u53ef\u4ee5\u501f\u52a9SVG\u6ee4\u955c\u201c\u66f2\u7ebf\u6551\u56fd\u201d\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[895],"tags":[1519,1055,1203,1202,368,642,1769,885,206],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9986"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=9986"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9986\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=9986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=9986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=9986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}