{"id":52811,"date":"2024-12-03T12:11:03","date_gmt":"2024-12-03T04:11:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52811\/"},"modified":"2024-12-03T12:11:03","modified_gmt":"2024-12-03T04:11:03","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-css-%e9%80%89%e6%8b%a9%e5%99%a8%e5%ae%9e%e7%8e%b0%e6%bf%80%e6%b4%bb%e6%a0%87%e7%ad%be%e7%9b%b8%e9%82%bb%e5%85%83%e7%b4%a0%e7%9a%84%e5%9c%86%e8%a7%92%e6%95%88-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52811\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f<\/h1>\n<p>\u5728\u6587\u7ae0\u5b9e\u6218\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u4e00\u4e9b\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u7136\u540e\u8981\u5361\u597d\u534a\u5929\uff0c\u7b49\u95ee\u9898\u89e3\u51b3\u4e86\u624d\u53d1\u73b0\u539f\u6765\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u662f\u6ca1\u6709\u638c\u63e1\u597d\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f\u300b\uff0c\u804a\u804a\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u6b63\u5728\u52aa\u529b\u8d5a\u94b1\u7684\u4f60\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/17323546086741a23066741.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>css \u9009\u62e9\u76f8\u90bb\u6fc0\u6d3b\u6807\u7b7e\u7684\u5143\u7d20<\/strong><\/p>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u56fe\u7247\u4e2d\u6240\u793a\u7684\u6837\u5f0f\uff0c\u9700\u8981\u5229\u7528 css \u9009\u62e9\u5668\u6765\u9488\u5bf9\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u7684\u524d\u540e\u5143\u7d20\u8fdb\u884c\u64cd\u4f5c\u3002\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>jsfiddle: https:\/\/jsfiddle.net\/b8fv42g0\/<\/p>\n<pre>\/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e *\/\n.active {\n  background: #fff;\n}\n\n\/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e\u540e\u7684\u5143\u7d20 *\/\n.active + li {\n  border-radius: 0 10px 0 0;\n}\n\n\/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e\u524d\u7684\u5143\u7d20 *\/\nli:has(+.active) {\n  border-radius: 0 0 10px 0;\n}<\/pre>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li>:has \u9009\u62e9\u5668\u7528\u4e8e\u9009\u62e9\u5305\u542b\u7279\u5b9a\u5143\u7d20\u6216\u5b50\u5143\u7d20\u7684\u5143\u7d20\uff0c\u56e0\u6b64 li:has(+.active) \u9009\u62e9\u5668\u4f1a\u9009\u62e9\u6240\u6709\u5305\u542b\u4e00\u4e2a\u6ee1\u8db3 .active \u7c7b\u9009\u62e9\u5668\u7684\u540e\u4ee3\u5143\u7d20\u7684 li \u5143\u7d20\u3002<\/li>\n<li>\u4f7f\u7528 border-radius \u5c5e\u6027\u53ef\u4ee5\u6539\u53d8\u5143\u7d20\u8fb9\u6846\u7684\u5706\u89d2\u534a\u5f84\uff0c\u4ece\u800c\u5b9e\u73b0\u5706\u89d2\u6548\u679c\u3002<\/li>\n<\/ul>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   Vue \u4e2d Select \u6807\u7b7e v-on:change \u4e8b\u4ef6\u4ec5\u6267\u884c\u4e00\u6b21\u5982\u4f55\u89e3\u51b3\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f \u5728\u6587\u7ae0\u5b9e\u6218\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u4e00\u4e9b\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u7136\u540e\u8981\u5361\u597d\u534a\u5929\uff0c\u7b49\u95ee\u9898\u89e3\u51b3\u4e86\u624d\u53d1\u73b0\u539f\u6765\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u662f\u6ca1\u6709\u638c\u63e1\u597d\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528 CSS \u9009\u62e9\u5668\u5b9e\u73b0\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u5143\u7d20\u7684\u5706\u89d2\u6548\u679c\uff1f\u300b\uff0c\u804a\u804a\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u6b63\u5728\u52aa\u529b\u8d5a\u94b1\u7684\u4f60\u3002 css \u9009\u62e9\u76f8\u90bb\u6fc0\u6d3b\u6807\u7b7e\u7684\u5143\u7d20 \u4e3a\u4e86\u5b9e\u73b0\u56fe\u7247\u4e2d\u6240\u793a\u7684\u6837\u5f0f\uff0c\u9700\u8981\u5229\u7528 css \u9009\u62e9\u5668\u6765\u9488\u5bf9\u6fc0\u6d3b\u6807\u7b7e\u76f8\u90bb\u7684\u524d\u540e\u5143\u7d20\u8fdb\u884c\u64cd\u4f5c\u3002\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a jsfiddle: https:\/\/jsfiddle.net\/b8fv42g0\/ \/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e *\/ .active { background: #fff; } \/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e\u540e\u7684\u5143\u7d20 *\/ .active + li { border-radius: 0 10px 0 0; } \/* \u9009\u62e9\u6fc0\u6d3b\u6807\u7b7e\u524d\u7684\u5143\u7d20 *\/ li:has(+.active) { border-radius: 0 0 10px 0; } \u8bf4\u660e\uff1a :has \u9009\u62e9\u5668\u7528\u4e8e\u9009\u62e9\u5305\u542b\u7279\u5b9a\u5143\u7d20\u6216\u5b50\u5143\u7d20\u7684\u5143\u7d20\uff0c\u56e0\u6b64 li:has(+.active) \u9009\u62e9\u5668\u4f1a\u9009\u62e9\u6240\u6709\u5305\u542b\u4e00\u4e2a\u6ee1\u8db3 .active \u7c7b\u9009\u62e9\u5668\u7684\u540e\u4ee3\u5143\u7d20\u7684 li \u5143\u7d20\u3002 \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-52811","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52811","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=52811"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52811\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}