{"id":2030,"date":"2024-11-10T15:06:04","date_gmt":"2024-11-10T07:06:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2030\/"},"modified":"2024-11-10T15:06:04","modified_gmt":"2024-11-10T07:06:04","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-css-mask-%e5%ae%9e%e7%8e%b0%e9%bc%a0%e6%a0%87%e6%82%ac%e5%81%9c%e6%97%b6%e6%98%be%e7%a4%ba%e9%9a%90%e8%97%8f%e5%9b%be%e7%89%87%e7%9a%84%e6%a4%ad%e5%9c%86%e5%8c%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2030\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 CSS Mask \u5b9e\u73b0\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u9690\u85cf\u56fe\u7247\u7684\u692d\u5706\u533a\u57df\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173063197289296.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 CSS Mask \u5b9e\u73b0\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u9690\u85cf\u56fe\u7247\u7684\u692d\u5706\u533a\u57df\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 CSS Mask \u5b9e\u73b0\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u9690\u85cf\u56fe\u7247\u7684\u692d\u5706\u533a\u57df\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u56fe\u7247\u91cd\u53e0\uff0c\u533a\u57df\u663e\u9732\u5e95\u56fe<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u5c06\u4e24\u5f20\u56fe\u7247\u53e0\u653e\uff0c\u5728\u9f20\u6807\u79fb\u52a8\u5230\u6307\u5b9a\u533a\u57df\u65f6\uff0c\u9732\u51fa\u5e95\u5c42\u56fe\u7247\u7684\u5185\u5bb9\uff1f<\/p>\n<p><strong>\u4e24\u5f20\u56fe\u7247\u793a\u4f8b\uff1a<\/strong><\/p>\n<ul>\n<li>\u7b2c\u4e00\u56fe\uff1ahttps:\/\/example.com\/image1.png<\/li>\n<li>\u7b2c\u4e8c\u56fe\uff1ahttps:\/\/example.com\/image2.png<\/li>\n<\/ul>\n<p><strong>\u9884\u671f\u6548\u679c\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ul>\n<li>\u9f20\u6807\u79fb\u52a8\u5230\u7279\u5b9a\u692d\u5706\u533a\u57df\u65f6\uff0c\u663e\u793a\u7b2c\u4e8c\u5f20\u56fe\u7247\u7684\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u4f7f\u7528  mask \u5c5e\u6027\uff1a<\/strong><\/li>\n<\/ol>\n<pre>.container {\n  mask-image: url(mask-image.png);\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li><strong>mask-image \u6307\u5b9a\u906e\u7f69\u56fe\u7247\uff0c\u5b9a\u4e49\u4e86\u9700\u8981\u663e\u793a\u7b2c\u4e8c\u5f20\u56fe\u7247\u7684\u533a\u57df\u3002<\/strong><\/li>\n<\/ul>\n<ol>\n<li><strong>\u8c03\u6574\u906e\u7f69\u56fe\u7247\uff1a<\/strong><\/li>\n<\/ol>\n<p>\u521b\u5efa\u906e\u7f69\u56fe\u7247\uff08mask-image.png\uff09\u5e76\u7f16\u8f91\u5176\u900f\u660e\u5ea6\uff0c\u4ee5\u8bbe\u7f6e\u692d\u5706\u533a\u57df\u3002<\/p>\n<ol>\n<li><strong>\u8bbe\u7f6e \uff1ahidden\uff1b<\/strong><\/li>\n<\/ol>\n<pre>.container {\n  overflow: hidden;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li><strong>\u9690\u85cf\u906e\u7f69\u56fe\u7247\u4e4b\u5916\u7684\u5185\u5bb9\uff0c\u786e\u4fdd\u53ea\u663e\u793a\u6307\u5b9a\u7684\u692d\u5706\u533a\u57df\u3002<\/strong><\/li>\n<\/ul>\n<ol>\n<li><strong>\u6dfb\u52a0\u4ea4\u4e92\u6027\uff1a<\/strong><\/li>\n<\/ol>\n<pre>.container:hover {\n  mask-image: none;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li><strong>\u5c06 mask-image \u8bbe\u7f6e\u4e3a none\uff0c\u5728\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u5e95\u5c42\u56fe\u7247\u3002<\/strong><\/li>\n<\/ul>\n<p><strong>\u6f14\u793a\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u6839\u636e\u4ee5\u4e0b demo \u4ee3\u7801\u8fdb\u884c\u4fee\u6539\u8c03\u6574\uff0c\u5305\u62ec\u692d\u5706\u5927\u5c0f\u3001\u6e10\u53d8\u4f4d\u7f6e\u7b49\u3002<\/p>\n<p><strong>demo \u94fe\u63a5\uff1a<\/strong><\/p>\n<p>[https:\/\/codepen.io\/pen\/xxx](\u6f14\u793a\u4ee3\u7801\u94fe\u63a5)<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<p>\u6b64\u89e3\u51b3\u65b9\u6848\u57fa\u4e8e css mask \u5c5e\u6027\uff0c\u517c\u5bb9\u6027\u6709\u9650\uff0c\u4e0d\u652f\u6301\u8f83\u65e9\u7684\u6d4f\u89c8\u5668\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 CSS Mask \u5b9e\u73b0\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u9690\u85cf\u56fe\u7247\u7684\u692d\u5706\u533a\u57df\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u56fe\u7247\u91cd\u53e0\uff0c\u533a\u57df\u663e\u9732\u5e95\u56fe \u95ee\u9898\uff1a\u5982\u4f55\u5c06\u4e24\u5f20\u56fe\u7247\u53e0\u653e\uff0c\u5728\u9f20\u6807\u79fb\u52a8\u5230\u6307\u5b9a\u533a\u57df\u65f6\uff0c\u9732\u51fa\u5e95\u5c42\u56fe\u7247\u7684\u5185\u5bb9\uff1f \u4e24\u5f20\u56fe\u7247\u793a\u4f8b\uff1a \u7b2c\u4e00\u56fe\uff1ahttps:\/\/example.com\/image1.png \u7b2c\u4e8c\u56fe\uff1ahttps:\/\/example.com\/image2.png \u9884\u671f\u6548\u679c\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u9f20\u6807\u79fb\u52a8\u5230\u7279\u5b9a\u692d\u5706\u533a\u57df\u65f6\uff0c\u663e\u793a\u7b2c\u4e8c\u5f20\u56fe\u7247\u7684\u5185\u5bb9\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u4f7f\u7528 mask \u5c5e\u6027\uff1a .container { mask-image: url(mask-image.png); } \u767b\u5f55\u540e\u590d\u5236 mask-image \u6307\u5b9a\u906e\u7f69\u56fe\u7247\uff0c\u5b9a\u4e49\u4e86\u9700\u8981\u663e\u793a\u7b2c\u4e8c\u5f20\u56fe\u7247\u7684\u533a\u57df\u3002 \u8c03\u6574\u906e\u7f69\u56fe\u7247\uff1a \u521b\u5efa\u906e\u7f69\u56fe\u7247\uff08mask-image.png\uff09\u5e76\u7f16\u8f91\u5176\u900f\u660e\u5ea6\uff0c\u4ee5\u8bbe\u7f6e\u692d\u5706\u533a\u57df\u3002 \u8bbe\u7f6e \uff1ahidden\uff1b .container { overflow: hidden; } \u767b\u5f55\u540e\u590d\u5236 \u9690\u85cf\u906e\u7f69\u56fe\u7247\u4e4b\u5916\u7684\u5185\u5bb9\uff0c\u786e\u4fdd\u53ea\u663e\u793a\u6307\u5b9a\u7684\u692d\u5706\u533a\u57df\u3002 \u6dfb\u52a0\u4ea4\u4e92\u6027\uff1a .container:hover { mask-image: none; } \u767b\u5f55\u540e\u590d\u5236 \u5c06 mask-image \u8bbe\u7f6e\u4e3a none\uff0c\u5728\u9f20\u6807\u60ac\u505c\u65f6\u663e\u793a\u5e95\u5c42\u56fe\u7247\u3002 \u6f14\u793a\uff1a \u53ef\u4ee5\u6839\u636e\u4ee5\u4e0b demo \u4ee3\u7801\u8fdb\u884c\u4fee\u6539\u8c03\u6574\uff0c\u5305\u62ec\u692d\u5706\u5927\u5c0f\u3001\u6e10\u53d8\u4f4d\u7f6e\u7b49\u3002 demo \u94fe\u63a5\uff1a [https:\/\/codepen.io\/pen\/xxx](\u6f14\u793a\u4ee3\u7801\u94fe\u63a5) \u6ce8\u610f\uff1a \u6b64\u89e3\u51b3\u65b9\u6848\u57fa\u4e8e css mask \u5c5e\u6027\uff0c\u517c\u5bb9\u6027\u6709\u9650\uff0c\u4e0d\u652f\u6301\u8f83\u65e9\u7684\u6d4f\u89c8\u5668\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2030","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=2030"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2030\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}