{"id":53418,"date":"2024-12-03T08:31:11","date_gmt":"2024-12-03T00:31:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53418\/"},"modified":"2024-12-03T08:31:11","modified_gmt":"2024-12-03T00:31:11","slug":"%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8css%e5%ae%9e%e7%8e%b0%e5%9c%86%e7%8e%af%e8%bf%9b%e5%ba%a6%e6%9d%a1%e7%9a%84%e5%86%85%e7%8e%af%e9%98%b4%e5%bd%b1%e6%95%88%e6%9e%9c%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53418\/","title":{"rendered":"\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f <\/h1>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f \u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241130\/1732940685674a938d035c3.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5706\u73af\u8fdb\u5ea6\u6761\u5b9e\u73b0\u5185\u73af\u9634\u5f71\u65b9\u6cd5<\/strong><\/p>\n<p>\u8981\u5b9e\u73b0\u5e26\u6709\u9634\u5f71\u6548\u679c\u7684\u5706\u73af\u8fdb\u5ea6\u6761\uff0c\u9700\u8981\u4f7f\u7528 CSS \u4e2d\u7684 box-shadow \u5c5e\u6027\u3002<\/p>\n<p><strong>\u5177\u4f53\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u521b\u5efa\u5706\u73af\u5bb9\u5668\uff08.circle\uff09\uff1a<\/strong>\u8bbe\u7f6e\u5bb9\u5668\u4e3a\u6b63\u65b9\u5f62\uff0c\u5e76\u4f7f\u7528 justify-content \u548c align-items \u5bf9\u9f50\u5b50\u5143\u7d20\u3002<\/li>\n<li><strong>\u521b\u5efa\u5de6\u534a\u5706\uff08.circle-left\uff09\uff1a<\/strong>\u4f7f\u7528 clip \u5c5e\u6027\u88c1\u526a\u4e00\u4e2a\u4e00\u534a\u5706\uff0c\u5e76\u586b\u5145\u80cc\u666f\u989c\u8272\u548c\u56fe\u5c42\u906e\u7f69\u3002<\/li>\n<li><strong>\u521b\u5efa\u53f3\u534a\u5706\uff08.circle-right\uff09\uff1a<\/strong>\u4e0e\u5de6\u534a\u5706\u7c7b\u4f3c\uff0c\u4f46\u88c1\u526a\u7684\u662f\u53e6\u4e00\u534a\u5706\u3002<\/li>\n<li><strong>\u521b\u5efa\u5916\u73af\uff08.circle-l\uff09\uff1a<\/strong>\u4f7f\u7528\u5706\u5f62 border-radius \u548c box-shadow \u521b\u5efa\u5916\u73af\u9634\u5f71\u6548\u679c\u3002<\/li>\n<li><strong>\u521b\u5efa\u5185\u73af\uff08.circle-s\uff09\uff1a<\/strong>\u518d\u6b21\u4f7f\u7528\u5706\u5f62 border-radius \u548c box-shadow \u521b\u5efa\u5185\u73af\uff0c\u4f46\u8fd9\u6b21\u9634\u5f71\u5e94\u671d\u76f8\u53cd\u65b9\u5411\uff08-2rpx -2rpx\uff09\u3002<\/li>\n<li><strong>\u8c03\u6574\u6587\u672c\uff08.circle_num\uff09\uff1a<\/strong>\u6dfb\u52a0\u4e00\u4e2a position: absolute \u7684\u6587\u672c\u5143\u7d20\uff0c\u5e76\u6839\u636e percent \u503c\u52a8\u6001\u66f4\u65b0\u5176\u6837\u5f0f\u3002<\/li>\n<\/ol>\n<p><strong>\u53c2\u8003\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>&lt;view class=\"circle\"&gt;\n  &lt;view class=\"circle-left\"&gt;\n    &lt;view class=\"left\"&gt;&lt;\/view&gt;\n  &lt;\/view&gt;\n  &lt;view class=\"circle-right\"&gt;\n    &lt;view class=\"right\"&gt;&lt;\/view&gt;\n  &lt;\/view&gt;\n  &lt;view class=\"circle-l\"&gt;&lt;\/view&gt;\n  &lt;view class=\"circle-s\"&gt;&lt;\/view&gt;\n  &lt;view class=\"circle_num\"&gt;{{percent}}%&lt;\/view&gt;\n&lt;\/view&gt;<\/pre>\n<pre>.circle {\n  position: relative;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  height: 450rpx;\n\n  .circle-left {\n    position: absolute;\n    width: 400rpx;\n    height: 400rpx;\n    clip: rect(0rpx, 200rpx, 400rpx, 0rpx);\n    border-radius: 50%;\n    background-color: #1C1D23;\n\n    .left {\n      position: absolute;\n      width: 400rpx;\n      height: 400rpx;\n      clip: rect(0rpx, 200rpx, 400rpx, 0rpx);\n      background-color: #1C1D23;\n      border-radius: 50%;\n    }\n  }\n\n  .circle-right {\n    position: absolute;\n    width: 400rpx;\n    height: 400rpx;\n    clip: rect(0rpx, 400rpx, 400rpx, 200rpx);\n    border-radius: 50%;\n    background-color: #1C1D23;\n\n    .right {\n      position: absolute;\n      width: 400rpx;\n      height: 400rpx;\n      clip: rect(0rpx, 400rpx, 400rpx, 200rpx);\n      background-color: #1C1D23;\n      border-radius: 50%;\n    }\n  }\n\n  .circle-l {\n    position: absolute;\n    width: 450rpx;\n    height: 450rpx;\n    border-radius: 50%;\n    box-shadow: 0rpx 0rpx 20rpx #4F4F5B;\n    background: #1C1D23;\n  }\n\n  .circle-s {\n    position: absolute;\n    width: 280rpx;\n    height: 280rpx;\n    border-radius: 50%;\n    box-shadow: -2rpx -2rpx 6rpx #fff;\n    background: #23232B;\n  }\n\n  .circle_num {\n    position: absolute;\n    width: 100%;\n    font-size: 2rem;\n    color: #fff;\n    z-index: 6;\n  }\n}<\/pre>\n<p>\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e9b\u6280\u5de7\uff0c\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u5e26\u6709\u9634\u5f71\u6548\u679c\u7684\u5706\u73af\u8fdb\u5ea6\u6761\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f \u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5982\u4f55\u5728\u5fae\u4fe1\u7535\u8111\u7248\u4e2d\u4f7f\u7528\u670b\u53cb\u5708\u529f\u80fd\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f \u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u5229\u7528CSS\u5b9e\u73b0\u5706\u73af\u8fdb\u5ea6\u6761\u7684\u5185\u73af\u9634\u5f71\u6548\u679c\uff1f \u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 \u5706\u73af\u8fdb\u5ea6\u6761\u5b9e\u73b0\u5185\u73af\u9634\u5f71\u65b9\u6cd5 \u8981\u5b9e\u73b0\u5e26\u6709\u9634\u5f71\u6548\u679c\u7684\u5706\u73af\u8fdb\u5ea6\u6761\uff0c\u9700\u8981\u4f7f\u7528 CSS \u4e2d\u7684 box-shadow \u5c5e\u6027\u3002 \u5177\u4f53\u6b65\u9aa4\uff1a \u521b\u5efa\u5706\u73af\u5bb9\u5668\uff08.circle\uff09\uff1a\u8bbe\u7f6e\u5bb9\u5668\u4e3a\u6b63\u65b9\u5f62\uff0c\u5e76\u4f7f\u7528 justify-content \u548c align-items \u5bf9\u9f50\u5b50\u5143\u7d20\u3002 \u521b\u5efa\u5de6\u534a\u5706\uff08.circle-left\uff09\uff1a\u4f7f\u7528 clip \u5c5e\u6027\u88c1\u526a\u4e00\u4e2a\u4e00\u534a\u5706\uff0c\u5e76\u586b\u5145\u80cc\u666f\u989c\u8272\u548c\u56fe\u5c42\u906e\u7f69\u3002 \u521b\u5efa\u53f3\u534a\u5706\uff08.circle-right\uff09\uff1a\u4e0e\u5de6\u534a\u5706\u7c7b\u4f3c\uff0c\u4f46\u88c1\u526a\u7684\u662f\u53e6\u4e00\u534a\u5706\u3002 \u521b\u5efa\u5916\u73af\uff08.circle-l\uff09\uff1a\u4f7f\u7528\u5706\u5f62 border-radius \u548c box-shadow \u521b\u5efa\u5916\u73af\u9634\u5f71\u6548\u679c\u3002 \u521b\u5efa\u5185\u73af\uff08.circle-s\uff09\uff1a\u518d\u6b21\u4f7f\u7528\u5706\u5f62 border-radius \u548c box-shadow \u521b\u5efa\u5185\u73af\uff0c\u4f46\u8fd9\u6b21\u9634\u5f71\u5e94\u671d\u76f8\u53cd\u65b9\u5411\uff08-2rpx -2rpx\uff09\u3002 \u8c03\u6574\u6587\u672c\uff08.circle_num\uff09\uff1a\u6dfb\u52a0\u4e00\u4e2a position: absolute \u7684\u6587\u672c\u5143\u7d20\uff0c\u5e76\u6839\u636e percent \u503c\u52a8\u6001\u66f4\u65b0\u5176\u6837\u5f0f\u3002 \u53c2\u8003\u793a\u4f8b\uff1a &lt;view class=&#8221;circle&#8221;&gt; &lt;view class=&#8221;circle-left&#8221;&gt; &lt;view class=&#8221;left&#8221;&gt;&lt;\/view&gt; &lt;\/view&gt; &lt;view class=&#8221;circle-right&#8221;&gt; &lt;view class=&#8221;right&#8221;&gt;&lt;\/view&gt; &lt;\/view&gt; &lt;view class=&#8221;circle-l&#8221;&gt;&lt;\/view&gt; &lt;view class=&#8221;circle-s&#8221;&gt;&lt;\/view&gt; &lt;view class=&#8221;circle_num&#8221;&gt;{{percent}}%&lt;\/view&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-53418","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53418","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=53418"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53418\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}