{"id":26015,"date":"2024-11-24T10:45:19","date_gmt":"2024-11-24T02:45:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26015\/"},"modified":"2024-11-24T10:45:19","modified_gmt":"2024-11-24T02:45:19","slug":"%e5%bd%a2%e7%8a%b6-css-%e6%8c%91%e6%88%98-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26015\/","title":{"rendered":"\u5f62\u72b6 &#8211; CSS \u6311\u6218"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173077560422578.jpg\" class=\"aligncenter\" title=\"\u5f62\u72b6 &#8211; CSS \u6311\u6218\u63d2\u56fe\" alt=\"\u5f62\u72b6 &#8211; CSS \u6311\u6218\u63d2\u56fe\" \/><\/p>\n<p>\u60a8\u53ef\u4ee5\u5728 hub \u4ed3\u5e93\u4e2d\u627e\u5230\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u7684\u6240\u6709\u4ee3\u7801\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u5728\u6b64\u5904\u67e5\u770b codesandbox \u7684\u89c6\u89c9\u6548\u679c\u3002<\/p>\n<hr>\n<h2> \u901a\u8fc7\u7ed8\u5236\u5404\u79cd\u5f62\u72b6 <\/h2>\n<hr>\n<p>\u5982\u4f55\u5728 css \u4e2d\u7ed8\u5236\u6b63\u65b9\u5f62\u3001\u68af\u5f62\u3001\u4e09\u89d2\u5f62\u3001\u5f02\u5f62\u4e09\u89d2\u5f62\u3001\u6247\u5f62\u3001\u5706\u5f62\u3001\u534a\u5706\u3001\u56fa\u5b9a\u5bbd\u9ad8\u6bd4\u30010.5px \u7ebf\uff1f<\/p>\n<pre>&lt;!doctype html&gt;\n&lt;html lang=\"en\"&gt;\n  &lt;head&gt;\n    &lt;meta charset=\"utf-8\" \/&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\n    &lt;meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\" \/&gt;\n    &lt;title&gt;shapes&lt;\/title&gt;\n    &lt;link rel=\"stylesheet\" href=\"styles.css\" \/&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;div class=\"square\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"trapezoidal\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"triangle\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"ano-triangle\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"sector\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"circle\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"half-circle\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"fixed-width-height-ratio\"&gt;&lt;\/div&gt;\n\n    &lt;div class=\"half-one-px-line\"&gt;0.5px line&lt;\/div&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>.square {\n  width: 100px;\n  height: 100px;\n  border-top: 50px solid red;\n  border-bottom: 50px solid blue;\n  border-right: 50px solid green;\n  border-left: 50px solid orange;\n}\n\n.trapezoidal {\n  width: 100px;\n  height: 100px;\n  border: 50px solid transparent;\n  border-bottom-color: tomato;\n}\n\n.triangle {\n  width: 0;\n  height: 0;\n  border: 50px solid transparent;\n  border-bottom-color: tomato;\n}\n\n.sector {\n  width: 0;\n  height: 0;\n  border: 50px solid transparent;\n  border-bottom-color: tomato;\n  border-radius: 50%;\n}\n\n.circle {\n  width: 100px;\n  height: 100px;\n  border-radius: 50%;\n  background-color: tomato;\n}\n\n.half-circle {\n  width: 100px;\n  height: 50px;\n  background-color: tomato;\n  border-top-left-radius: 50px;\n  border-top-right-radius: 50px;\n}\n\n.fixed-width-height-ratio {\n  padding-top: 56.25%;\n  background-color: blue;\n  width: 100%;\n}\n\n.half-one-px-line {\n  background-color: aqua;\n  border-bottom: 1px solid black;\n  transform: scaleY(0.5) scaleX(0.5);\n  transform-origin: 0 0;\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5f62\u72b6 &#8211; CSS \u6311\u6218\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>\u60a8\u53ef\u4ee5\u5728 hub \u4ed3\u5e93\u4e2d\u627e\u5230\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u7684\u6240\u6709\u4ee3\u7801\u3002 \u60a8\u53ef\u4ee5\u5728\u6b64\u5904\u67e5\u770b codesandbox \u7684\u89c6\u89c9\u6548\u679c\u3002 \u901a\u8fc7\u7ed8\u5236\u5404\u79cd\u5f62\u72b6 \u5982\u4f55\u5728 css \u4e2d\u7ed8\u5236\u6b63\u65b9\u5f62\u3001\u68af\u5f62\u3001\u4e09\u89d2\u5f62\u3001\u5f02\u5f62\u4e09\u89d2\u5f62\u3001\u6247\u5f62\u3001\u5706\u5f62\u3001\u534a\u5706\u3001\u56fa\u5b9a\u5bbd\u9ad8\u6bd4\u30010.5px \u7ebf\uff1f &lt;!doctype html&gt; &lt;html lang=&#8221;en&#8221;&gt; &lt;head&gt; &lt;meta charset=&#8221;utf-8&#8243; \/&gt; &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243; \/&gt; &lt;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=edge&#8221; \/&gt; &lt;title&gt;shapes&lt;\/title&gt; &lt;link rel=&#8221;stylesheet&#8221; href=&#8221;styles.css&#8221; \/&gt; &lt;\/head&gt; &lt;body&gt; &lt;div class=&#8221;square&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;trapezoidal&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;triangle&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;ano-triangle&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;sector&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;circle&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;half-circle&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;fixed-width-height-ratio&#8221;&gt;&lt;\/div&gt; &lt;div class=&#8221;half-one-px-line&#8221;&gt;0.5px line&lt;\/div&gt; &lt;\/body&gt; [&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-26015","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26015","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=26015"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26015\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}