{"id":27053,"date":"2024-11-24T13:13:35","date_gmt":"2024-11-24T05:13:35","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27053\/"},"modified":"2024-11-24T13:13:35","modified_gmt":"2024-11-24T05:13:35","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-css-%e5%ae%9e%e7%8e%b0%e9%80%8f%e6%98%8e%e8%83%8c%e6%99%af%e4%b8%94%e8%be%b9%e6%a1%86%e4%b8%ba-1px-%e7%9a%84%e5%85%ad%e8%be%b9%e5%bd%a2%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27053\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173115243582446.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u900f\u660e\u80cc\u666f\u7684\u516d\u8fb9\u5f62  \u5b9e\u73b0<\/strong><\/p>\n<p>\u5728\u8bbe\u8ba1\u56fe\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\u3002\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u5462\uff1f<\/p>\n<h3>SVG \u65b9\u6cd5<\/h3>\n<p>SVG\uff08\u53ef\u7f29\u653e\u77e2\u91cf\u56fe\u5f62\uff09\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u516d\u8fb9\u5f62\u3002\u4ee5\u4e0b\u4ee3\u7801\u5b9e\u73b0\u4e86\u900f\u660e\u80cc\u666f\u30011px \u8fb9\u6846\u7684\u516d\u8fb9\u5f62\uff1a<\/p>\n<pre>&lt;svg width=\"500\" height=\"500\"&gt;\n  &lt;polygon points=\"100,30 140,50 140,90 100,110 60,90 60,50\" style=\"fill: transparent;stroke: #e07cc2; stroke-width:3px;\"&gt;&lt;\/polygon&gt;\n&lt;\/svg&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>\u7eaf CSS \u65b9\u6cd5<\/h3>\n<p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u7eaf CSS\u3002\u901a\u8fc7\u521b\u5efa\u4ee5\u4e0b HTML \u548c CSS \u4ee3\u7801\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5177\u6709\u900f\u660e\u80cc\u666f\u30011px \u8fb9\u6846\u7684\u516d\u8fb9\u5f62\uff1a<\/p>\n<pre>&lt;div class=\"hexagon-container\"&gt;\n  &lt;div class=\"hexagon\"&gt;&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>.hexagon-container {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  height: 200px; \n}\n\n.hexagon {\n  position: relative;\n  width: 100px;\n  height: 100px;\n  background-color: pink;\n  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);\n}\n\n.hexagon:before {\n  content: \"\";\n  position: absolute;\n  top: 2px;\n  left: 2px;\n  width: 96px;\n  height: 96px;\n  background-color: #fff;\n  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\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>\u900f\u660e\u80cc\u666f\u7684\u516d\u8fb9\u5f62 \u5b9e\u73b0 \u5728\u8bbe\u8ba1\u56fe\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u900f\u660e\u80cc\u666f\u4e14\u8fb9\u6846\u4e3a 1px \u7684\u516d\u8fb9\u5f62\u3002\u5982\u4f55\u4f7f\u7528 CSS \u5b9e\u73b0\u5462\uff1f SVG \u65b9\u6cd5 SVG\uff08\u53ef\u7f29\u653e\u77e2\u91cf\u56fe\u5f62\uff09\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u516d\u8fb9\u5f62\u3002\u4ee5\u4e0b\u4ee3\u7801\u5b9e\u73b0\u4e86\u900f\u660e\u80cc\u666f\u30011px \u8fb9\u6846\u7684\u516d\u8fb9\u5f62\uff1a &lt;svg width=&#8221;500&#8243; height=&#8221;500&#8243;&gt; &lt;polygon points=&#8221;100,30 140,50 140,90 100,110 60,90 60,50&#8243; style=&#8221;fill: transparent;stroke: #e07cc2; stroke-width:3px;&#8221;&gt;&lt;\/polygon&gt; &lt;\/svg&gt; \u767b\u5f55\u540e\u590d\u5236 \u7eaf CSS \u65b9\u6cd5 \u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u7eaf CSS\u3002\u901a\u8fc7\u521b\u5efa\u4ee5\u4e0b HTML \u548c CSS \u4ee3\u7801\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5177\u6709\u900f\u660e\u80cc\u666f\u30011px \u8fb9\u6846\u7684\u516d\u8fb9\u5f62\uff1a &lt;div class=&#8221;hexagon-container&#8221;&gt; &lt;div class=&#8221;hexagon&#8221;&gt;&lt;\/div&gt; &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 .hexagon-container { display: flex; justify-content: center; align-items: center; height: 200px; } .hexagon [&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-27053","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27053","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=27053"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27053\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}