{"id":33,"date":"2024-06-09T16:07:33","date_gmt":"2024-06-09T16:07:33","guid":{"rendered":"http:\/\/blog.yikepi.com\/?p=33"},"modified":"2024-06-10T02:35:01","modified_gmt":"2024-06-10T02:35:01","slug":"%e6%82%a8%e9%9c%80%e8%a6%81%e4%ba%86%e8%a7%a3%e7%9a%84%e6%9c%89%e5%85%b3%e5%88%97%e8%a1%a8%e6%a0%87%e8%ae%b0%e5%90%8e%e7%9a%84%e9%97%b4%e9%9a%99%e7%9a%84%e6%89%80%e6%9c%89%e4%bf%a1%e6%81%af","status":"publish","type":"post","link":"https:\/\/www.yikepi.com\/index.php\/2024\/06\/09\/%e6%82%a8%e9%9c%80%e8%a6%81%e4%ba%86%e8%a7%a3%e7%9a%84%e6%9c%89%e5%85%b3%e5%88%97%e8%a1%a8%e6%a0%87%e8%ae%b0%e5%90%8e%e7%9a%84%e9%97%b4%e9%9a%99%e7%9a%84%e6%89%80%e6%9c%89%e4%bf%a1%e6%81%af\/","title":{"rendered":"\u60a8\u9700\u8981\u4e86\u89e3\u7684\u6709\u5173\u5217\u8868\u6807\u8bb0\u540e\u7684\u95f4\u9699\u7684\u6240\u6709\u4fe1\u606f"},"content":{"rendered":"\n<p>\u6211\u5728\u9605\u8bfbGoogle \u7684 web.dev \u535a\u5ba2\u4e0a\u7684<a href=\"https:\/\/web.dev\/creative-list-styling\/\">\u201c\u521b\u610f\u5217\u8868\u6837\u5f0f\u201d<\/a>\uff0c\u5e76\u6ce8\u610f\u5230\u6587\u7ae0\u90e8\u5206\u4e2d\u7684\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\u4e2d\u6709\u4e9b\u5947\u602a<code>::marker<\/code>\u3002\u5185\u7f6e\u5217\u8868\u6807\u8bb0\u662f\u9879\u76ee\u7b26\u53f7\u3001\u5e8f\u6570\u548c\u5b57\u6bcd\u3002<code>::marker<\/code>\u4f2a\u5143\u7d20\u5141\u8bb8\u6211\u4eec\u4e3a\u8fd9\u4e9b\u6807\u8bb0\u8bbe\u7f6e\u6837\u5f0f\u6216\u5c06\u5176\u66ff\u6362\u4e3a\u81ea\u5b9a\u4e49\u5b57\u7b26\u6216\u56fe\u50cf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::marker {\n  content: url('\/marker.svg') ' ';\n}<\/code><\/pre>\n\n\n\n<p>\u5f15\u8d77\u6211\u6ce8\u610f\u7684\u793a\u4f8b\u4f7f\u7528 SVG \u56fe\u6807\u4f5c\u4e3a\u5217\u8868\u9879\u7684\u81ea\u5b9a\u4e49\u6807\u8bb0\u3002\u4f46\u51fd\u6570<code>\" \"<\/code>\u65c1\u8fb9\u7684 CSS \u503c\u4e2d\u4e5f\u6709\u4e00\u4e2a\u7a7a\u683c\u5b57\u7b26 ( )&nbsp;<code>url()<\/code>\u3002\u8fd9\u4e2a\u7a7a\u683c\u7684\u7528\u9014\u4f3c\u4e4e\u662f\u5728\u81ea\u5b9a\u4e49\u6807\u8bb0\u540e\u63d2\u5165\u4e00\u4e2a\u95f4\u9699\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/svg-marker-and-space.png?resize=1373%2C843&amp;ssl=1\" alt=\"\" class=\"wp-image-376750\"\/><\/figure>\n\n\n\n<p>\u5f53\u6211\u770b\u5230\u8fd9\u6bb5\u4ee3\u7801\u65f6\uff0c\u6211\u7acb\u5373\u60f3\u77e5\u9053\u662f\u5426\u6709\u66f4\u597d\u7684\u65b9\u6cd5\u6765\u521b\u5efa\u95f4\u9699\u3002\u5728 \u4e2d\u6dfb\u52a0\u7a7a\u683c<code>content<\/code>\u611f\u89c9\u66f4\u50cf\u662f\u4e00\u79cd\u53d8\u901a\u65b9\u6cd5\uff0c\u800c\u4e0d\u662f\u6700\u4f73\u89e3\u51b3\u65b9\u6848\u3002CSS \u63d0\u4f9b\u4e86<code>margin<\/code>\u548c<code>padding<\/code>\u5176\u4ed6\u6807\u51c6\u65b9\u6cd5\u6765\u5728\u9875\u9762\u4e0a\u5206\u9694\u5143\u7d20\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u5c5e\u6027\u90fd\u4e0d\u80fd\u7528\u5417\uff1f<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u5c1d\u8bd5\u7528\u9002\u5f53\u7684\u8fb9\u8ddd\u66ff\u6362\u7a7a\u683c\u5b57\u7b26\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>::marker {\n  content: url('\/marker.svg');\n  margin-right: 1ch;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e0d\u8d77\u4f5c\u7528\u3002\u4e8b\u5b9e\u8bc1\u660e\uff0c\u5b83<code>::marker<\/code>\u4ec5\u652f\u6301\u4e00<a href=\"https:\/\/drafts.csswg.org\/css-lists-3\/#marker-properties\">\u5c0f\u90e8\u5206\u4e3b\u8981\u4e0e\u6587\u672c\u76f8\u5173\u7684 CSS \u5c5e\u6027<\/a>\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u66f4\u6539\u6807\u8bb0\u7684<code>font-size<\/code>\u548c\uff0c\u5e76\u901a\u8fc7\u8bbe\u7f6e\u4e3a\u5b57\u7b26\u4e32\u6216 URL \u6765\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6807\u8bb0\uff0c\u5982\u4e0a\u6240\u793a\u3002\u4f46\u662f\u548c\u5c5e\u6027\u4e0d\u53d7\u652f\u6301<a href=\"https:\/\/github.com\/w3c\/csswg-drafts\/issues\/4571\">\uff0c<\/a>\u56e0\u6b64\u8bbe\u7f6e\u5b83\u4eec\u6ca1\u6709\u6548\u679c\u3002<strong>\u771f\u4ee4\u4eba\u5931\u671b\u3002<\/strong><code>color<\/code><code>content<\/code><code>margin<\/code><code>padding<\/code><a href=\"https:\/\/github.com\/w3c\/csswg-drafts\/issues\/4571\"><\/a><strong><\/strong><\/p>\n\n\n\n<p>\u7a7a\u683c\u5b57\u7b26\u771f\u7684\u662f\u5728\u81ea\u5b9a\u4e49\u6807\u8bb0\u540e\u63d2\u5165\u95f4\u9699\u7684\u552f\u4e00\u65b9\u6cd5\u5417\uff1f\u6211\u9700\u8981\u627e\u51fa\u7b54\u6848\u3002\u5728\u7814\u7a76\u8fd9\u4e2a\u4e3b\u9898\u65f6\uff0c\u6211\u53d1\u73b0\u4e86\u4e00\u4e9b\u6709\u8da3\u7684\u4e1c\u897f\uff0c\u6211\u60f3\u5728\u672c\u6587\u4e2d\u5206\u4eab\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"adding-padding-and-margins\"><a href=\"https:\/\/css-tricks.com\/everything-you-need-to-know-about-the-gap-after-the-list-marker\/#aa-adding-padding-and-margins\"><\/a>\u6dfb\u52a0\u586b\u5145\u548c\u8fb9\u8ddd<\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u786e\u8ba4<code>margin<\/code>\u548c\u5143\u7d20<code>padding<\/code>\u4e0a\u8981\u505a\u4ec0\u4e48\u3002\u4e3a\u6b64\uff0c\u6211\u521b\u5efa\u4e86\u4e00\u4e2a\u6d4b\u8bd5\u9875\u9762\u3002\u62d6\u52a8\u76f8\u5173\u6ed1\u5757\u5e76\u89c2\u5bdf\u5217\u8868\u6807\u8bb0\u4e24\u4fa7\u95f4\u8ddd\u7684\u5f71\u54cd\u3002\u63d0\u793a\uff1a\u968f\u610f\u4f7f\u7528\u201c\u91cd\u7f6e\u201d\u6309\u94ae\u5c06\u6240\u6709\u63a7\u4ef6\u91cd\u7f6e\u4e3a\u5176\u521d\u59cb\u503c\u3002<code>&lt;ul&gt;<\/code><code>&lt;li&gt;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/codepen.io\/anon\/embed\/rNrdXWB?height=615&#038;theme-id=1&#038;slug-hash=rNrdXWB&#038;default-tab=result\n<\/div><\/figure>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u6d4f\u89c8\u5668\u9ed8\u8ba4\u5bf9\u548c\u5143\u7d20\u5e94\u7528\u903b\u8f91\u5c5e\u6027<code>padding-inline-left<\/code>\u3002\u903b\u8f91\u5c5e\u6027\u76f8\u5f53\u4e8e\u5177\u6709\u4ece\u5de6\u5230\u53f3\u5185\u8054\u65b9\u5411\u7684\u4e66\u5199\u7cfb\u7edf\u4e2d\u7684\u7269\u7406\u5c5e\u6027\u3002\u5728\u672c\u6587\u4e2d\uff0c\u4e3a\u4e86\u7b80\u5355\u8d77\u89c1\uff0c\u6211\u5c06\u4f7f\u7528\u7269\u7406\u5c5e\u6027<code>40px<\/code>\u3002<code>&lt;ol&gt;<\/code><code>&lt;ul&gt;<\/code><code>padding-inline-start<\/code><code>padding-left<\/code><\/p>\n\n\n\n<p>\u5982\u60a8\u6240\u89c1\uff0c<code>padding-left<\/code>on<code>&lt;li&gt;<\/code>\u4f1a\u589e\u52a0\u5217\u8868\u6807\u8bb0\u540e\u7684\u95f4\u9699\u3002\u5176\u4ed6\u4e09\u4e2a\u5c5e\u6027\u63a7\u5236\u6807\u8bb0\u5de6\u4fa7\u7684\u95f4\u8ddd\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u5c31\u662f\u5217\u8868\u9879\u7684\u7f29\u8fdb\u3002<\/p>\n\n\n\n<p>\u8bf7\u6ce8\u610f\uff0c\u5373\u4f7f\u5217\u8868\u9879\u7684<code>padding-left<\/code>\u503c\u4e3a\uff0c\u6807\u8bb0\u540e\u4ecd\u5b58\u5728\u6700\u5c0f\u95f4\u9699\u3002\u6b64\u95f4\u9699\u4e0d\u80fd\u901a\u8fc7\u6216<code>0px<\/code>\u51cf\u5c0f\u3002\u6700\u5c0f\u95f4\u9699\u7684\u786e\u5207\u957f\u5ea6\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3002<code>margin<\/code><code>padding<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/margin-padding-position-outside.png?resize=1417%2C890&amp;ssl=1\" alt=\"\u524d\u4e09\u4e2a\u5c5e\u6027\uff1aUL margin-left\u3001UL padding-left\u3001LI margin-left\u3002\u7b2c\u56db\u4e2a\u5c5e\u6027\uff1aLI padding-left\u3002\" class=\"wp-image-376751\"\/><figcaption class=\"wp-element-caption\">\u524d\u4e09\u4e2a\u5c5e\u6027\u5c06\u6574\u4e2a\u5217\u8868\u9879\uff08\u5305\u62ec\u6807\u8bb0\uff09\u63a8\u5230\u53f3\u4fa7\u3002\u7b2c\u56db\u4e2a\u5c5e\u6027\u4ec5\u5c06\u5217\u8868\u9879\u7684\u5185\u5bb9\u63a8\u5230\u53f3\u4fa7\u3002<\/figcaption><\/figure>\n\n\n\n<p>\u603b\u800c\u8a00\u4e4b\uff0c\u5217\u8868\u9879\u7684\u5185\u5bb9\u5b9a\u4f4d\u5728\u4e0e\u6807\u8bb0\u4e4b\u95f4\u6709\u6d4f\u89c8\u5668\u7279\u5b9a\u7684\u6700\u5c0f\u8ddd\u79bb\uff0c\u5e76\u4e14\u53ef\u4ee5\u901a\u8fc7<code>padding-left<\/code>\u5728 \u4e2d\u6dfb\u52a0 \u6765\u8fdb\u4e00\u6b65\u589e\u52a0\u6b64\u95f4\u9699<code>&lt;li&gt;<\/code>\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\uff0c\u8ba9\u6211\u4eec\u770b\u770b\u5c06\u6807\u8bb0\u5b9a\u4f4d<em>\u5728<\/em>\u5217\u8868\u9879\u5185\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"moving-the-marker-inside-the-list-item\"><a href=\"https:\/\/css-tricks.com\/everything-you-need-to-know-about-the-gap-after-the-list-marker\/#aa-moving-the-marker-inside-the-list-item\"><\/a>\u5728\u5217\u8868\u9879\u5185\u79fb\u52a8\u6807\u8bb0<\/h3>\n\n\n\n<p>\u8be5<code>list-style-position<\/code>\u5c5e\u6027\u63a5\u53d7\u4e24\u4e2a\u5173\u952e\u5b57\uff1a<code>outside<\/code>\uff0c\u8fd9\u662f\u9ed8\u8ba4\u503c\uff0c\u4ee5\u53ca<code>inside<\/code>\uff0c\u7528\u4e8e\u5728\u5217\u8868\u9879\u5185\u79fb\u52a8\u6807\u8bb0\u3002\u540e\u8005\u5bf9\u4e8e\u521b\u5efa\u5177\u6709\u5168\u5bbd\u5217\u8868\u9879\u7684\u8bbe\u8ba1\u5f88\u6709\u7528\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/list-marker-position-inside.png?resize=1608%2C918&amp;ssl=1\" alt=\"\u8d2d\u7269\u6e05\u5355\u3002\u6bcf\u9879\u5546\u54c1\u90fd\u6709\u4e00\u6761\u7ec6\u957f\u7684\u5e95\u90e8\u8fb9\u6846\uff0c\u4ece\u6e05\u5355\u7684\u5de6\u8fb9\u7f18\u5ef6\u4f38\u5230\u53f3\u8fb9\u7f18\u3002\" class=\"wp-image-376752\"\/><figcaption class=\"wp-element-caption\">\u5217\u8868\u6807\u8bb0\u4f4d\u4e8e\u5217\u8868\u9879\u5185\u90e8\uff0c\u4ee5\u4fbf\u5217\u8868\u9879\u7684\u5e95\u90e8\u8fb9\u6846\u53ef\u4ee5\u5ef6\u4f38\u5230\u5217\u8868\u6846\u7684\u5de6\u8fb9\u7f18<\/figcaption><\/figure>\n\n\n\n<p>\u5982\u679c\u6807\u8bb0\u73b0\u5728\u4f4d\u4e8e\u5217\u8868\u9879\u5185\uff0c\u8fd9\u662f\u5426\u610f\u5473\u7740<em>on<\/em><code>padding-left<\/code>\u4e0d\u518d<code>&lt;li&gt;<\/code>\u589e\u52a0\u6807\u8bb0\u540e\u7684\u95f4\u9699\uff1f\u8ba9\u6211\u4eec\u6765\u4e00\u63a2\u7a76\u7adf\u3002\u5728\u6211\u7684\u6d4b\u8bd5\u9875\u9762\u4e0a\uff0c<code>list-style-position: inside<\/code>\u901a\u8fc7\u590d\u9009\u6846\u6253\u5f00 on\u3002\u6b64\u66f4\u6539\u5bf9\u56db\u4e2a<code>padding<\/code>\u548c\u5c5e\u6027\u6709\u4f55\u5f71\u54cd\uff1f<code>margin<\/code><\/p>\n\n\n\n<p>\u5982\u60a8\u6240\u89c1\uff0c<code>padding-left<\/code>\u73b0\u5728\u589e\u52a0\u4e86\u6807\u8bb0<em>\u5de6\u4fa7<\/em><code>&lt;li&gt;<\/code>\u7684\u95f4\u8ddd\u3002\u8fd9\u610f\u5473\u7740\u6211\u4eec\u5931\u53bb\u4e86\u589e\u52a0\u6807\u8bb0\u540e\u95f4\u9699\u7684\u80fd\u529b\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u80fd\u591f\u6dfb\u52a0\u5230\u672c\u8eab\u4f1a\u5f88\u6709\u7528\uff0c\u4f46\u8fd9\u5e76\u4e0d\u594f\u6548\uff0c\u6b63\u5982\u6211\u4eec\u4e0a\u9762\u6240\u786e\u5b9a\u7684\u90a3\u6837\u3002<em><\/em><code>margin-right<\/code><code>::marker<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/margin-padding-position-inside.png?resize=1417%2C889&amp;ssl=1\" alt=\"\u8fd9\u56db\u4e2a\u5c5e\u6027\uff1aUL margin-left\u3001UL padding-left\u3001LI margin-left\u3001LI padding-left\u3002\" class=\"wp-image-376753\"\/><figcaption class=\"wp-element-caption\">\u6240\u6709\u56db\u4e2a\u5c5e\u6027\u90fd\u4f1a\u5c06\u6574\u4e2a\u5217\u8868\u9879\u63a8\u5230\u53f3\u4fa7\u3002\u6700\u5c0f\u95f4\u9699\u65e0\u6cd5\u901a\u8fc7\u6807\u51c6\u65b9\u6cd5\u589e\u52a0\u3002<\/figcaption><\/figure>\n\n\n\n<p><a href=\"https:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=725972\">\u6b64\u5916\uff0c Chromium \u4e2d<\/a>\u6709\u4e00\u4e2a\u9519\u8bef\uff0c\u5728\u5207\u6362\u5230\u5b9a\u4f4d\u540e\uff0c\u4f1a\u5bfc\u81f4\u6807\u8bb0\u540e\u7684\u95f4\u9699\u589e\u52a0<em>\u4e09\u500d<\/em><code>inside<\/code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u95f4\u9699\u7684\u957f\u5ea6\u7ea6\u4e3a\u6587\u672c\u5927\u5c0f\u7684\u4e09\u5206\u4e4b\u4e00\u3002\u56e0\u6b64\uff0c\u5728\u9ed8\u8ba4\u7684 \u4e0b<code>font-size<\/code>\uff0c<code>16px<\/code>\u95f4\u9699\u7ea6\u4e3a<code>5.5px<\/code>\u3002\u5207\u6362\u5230 \u540e\uff0c\u95f4\u9699\u5728 Chrome \u4e2d<code>inside<\/code>\u4f1a\u5b8c\u5168\u589e\u5927\u3002\u6b64\u9519\u8bef\u4f1a\u5f71\u54cd\u3001\u548c\u6807\u8bb0\uff0c\u4f46<a href=\"https:\/\/twitter.com\/g16n\/status\/1616807361061978118\">\u4e0d\u4f1a\u5f71\u54cd\u5e8f\u6570\u6807\u8bb0<\/a>\u3002<code>16px<\/code><code>disc<\/code><code>circle<\/code><code>square<\/code><a href=\"https:\/\/twitter.com\/g16n\/status\/1616807361061978118\"><\/a><\/p>\n\n\n\n<p>\u4e0b\u56fe\u663e\u793a\u4e86 macOS \u4e0a\u4e09\u4e2a\u4e3b\u6d41\u6d4f\u89c8\u5668\u5bf9\u4f4d\u4e8e\u5916\u90e8\u548c\u5185\u90e8\u7684\u5217\u8868\u6807\u8bb0\u7684\u9ed8\u8ba4\u6e32\u67d3\u3002\u4e3a\u4e86\u65b9\u4fbf\u8d77\u89c1\uff0c\u6211\u5df2\u5c06\u6240\u6709\u5217\u8868\u9879\u4e0e\u5176\u6807\u8bb0\u6c34\u5e73\u5bf9\u9f50\uff0c\u4ee5\u4fbf\u4e8e\u6bd4\u8f83\u95f4\u9699\u5927\u5c0f\u7684\u5dee\u5f02\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/outside-inside-gap-difference.png?resize=555%2C385&amp;ssl=1\" alt=\"\u516d\u4e2a\u5217\u8868\u9879\uff0c\u6807\u8bb0\u548c\u6587\u672c\u4e4b\u95f4\u7684\u95f4\u9699\u5404\u4e0d\u76f8\u540c\u3002\" class=\"wp-image-376754\"\/><figcaption class=\"wp-element-caption\">\u53ea\u6709 Firefox \u5728\u4e24\u79cd\u6807\u8bb0\u5b9a\u4f4d\u6a21\u5f0f\u4e4b\u95f4\u4fdd\u6301\u76f8\u540c\u7684\u95f4\u9699\u5927\u5c0f\u3002\u8fd9\u53ef\u4ee5\u89c6\u4e3a\u6d4f\u89c8\u5668\u4e92\u64cd\u4f5c\u6027 (&nbsp;<a href=\"https:\/\/web.dev\/interop-2022\/#what-is-interop-2022\">interop<\/a>&nbsp;) \u95ee\u9898\u3002<\/figcaption><\/figure>\n\n\n\n<p>\u603b\u800c\u8a00\u4e4b\uff0c\u5207\u6362\u5230<code>list-style-position: inside<\/code>\u4f1a\u5e26\u6765\u4e24\u4e2a\u95ee\u9898\u3002\u6211\u4eec\u65e0\u6cd5\u518d\u901a\u8fc7 \u6765\u589e\u52a0\u95f4\u9699<code>padding-left<\/code>\uff0c<code>&lt;li&gt;<\/code>\u5e76\u4e14\u4e0d\u540c\u6d4f\u89c8\u5668\u4e4b\u95f4\u7684\u95f4\u9699\u5927\u5c0f\u4e0d\u4e00\u81f4\u3002<\/p>\n\n\n\n<p>\u6700\u540e\uff0c\u8ba9\u6211\u4eec\u770b\u770b\u7528\u81ea\u5b9a\u4e49\u6807\u8bb0\u66ff\u6362\u9ed8\u8ba4\u5217\u8868\u6807\u8bb0\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"switching-to-a-custom-marker\"><a href=\"https:\/\/css-tricks.com\/everything-you-need-to-know-about-the-gap-after-the-list-marker\/#aa-switching-to-a-custom-marker\"><\/a>\u5207\u6362\u5230\u81ea\u5b9a\u4e49\u6807\u8bb0<\/h3>\n\n\n\n<p><a href=\"https:\/\/css-tricks.com\/css-counters-custom-list-number-styling\/\">\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6807\u8bb0<\/a>\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>list-style-type<\/code>\u548c<code>list-style-image<\/code>\u5c5e\u6027<\/li>\n\n\n\n<li><code>content<\/code><code>::marker<\/code>\u4f2a\u5143\u7d20\u4e0a\u7684\u5c5e\u6027<\/li>\n<\/ul>\n\n\n\n<p>\u5c5e\u6027\u7684\u529f\u80fd<code>content<\/code>\u66f4\u5f3a\u5927\uff0c\u6bd4\u5982\uff0c\u5b83\u5141\u8bb8\u6211\u4eec\u4f7f\u7528\u51fd\u6570<code>counter()<\/code>\u8bbf\u95ee\u5217\u8868\u9879\u7684\u5e8f\u6570\uff08<a href=\"https:\/\/drafts.csswg.org\/css-lists-3\/#list-item-counter\">\u9690\u5f0f<code>list-item<\/code>\u8ba1\u6570\u5668<\/a>\uff09\uff0c\u5e76\u7528\u81ea\u5b9a\u4e49\u5b57\u7b26\u4e32\u4fee\u9970\u5b83\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/codepen.io\/anon\/embed\/RwBQjvZ?height=350&#038;theme-id=1&#038;slug-hash=RwBQjvZ&#038;default-tab=css,result\n<\/div><\/figure>\n\n\n\n<p>\u4e0d\u5e78\u7684\u662f\uff0cSafari \u5c1a\u4e0d\u652f\u6301<code>content<\/code>on \u5c5e\u6027<code>::marker<\/code>\uff08<a href=\"https:\/\/bugs.webkit.org\/show_bug.cgi?id=204163\">WebKit \u9519\u8bef<\/a>\uff09\u3002\u56e0\u6b64\uff0c\u6211\u5c06\u4f7f\u7528 \u5c5e\u6027<code>list-style-type<\/code>\u6765\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6807\u8bb0\u3002\u60a8\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528<code>::marker<\/code>\u9009\u62e9\u5668\u6765\u8bbe\u7f6e\u901a\u8fc7 \u58f0\u660e\u7684\u81ea\u5b9a\u4e49\u6807\u8bb0\u7684\u6837\u5f0f\u3002Safari\u652f\u6301 \u7684<code>list-style-type<\/code>\u8fd9\u4e00\u65b9\u9762\u3002<code>::marker<\/code><\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/codepen.io\/anon\/embed\/ZEjXOwL?height=350&#038;theme-id=1&#038;slug-hash=ZEjXOwL&#038;default-tab=css,result\n<\/div><\/figure>\n\n\n\n<p>\u4efb\u4f55 Unicode \u5b57\u7b26\u90fd\u53ef\u4ee5\u4f5c\u4e3a\u81ea\u5b9a\u4e49\u5217\u8868\u6807\u8bb0\uff0c\u4f46\u53ea\u6709\u4e00\u5c0f\u90e8\u5206\u5b57\u7b26\u5b9e\u9645\u4e0a\u5728\u5176\u5b98\u65b9\u540d\u79f0\u4e2d\u5305\u542b\u201c\u9879\u76ee\u7b26\u53f7\u201d\uff0c\u56e0\u6b64\u6211\u60f3\u5728\u8fd9\u91cc\u7f16\u8bd1\u5b83\u4eec\u4ee5\u4f9b\u53c2\u8003\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u7279\u70b9<\/th><th>\u59d3\u540d<\/th><th>\u4ee3\u7801\u70b9<\/th><th>CSS \u5173\u952e\u5b57<\/th><\/tr><\/thead><tbody><tr><td>\u2022<\/td><td>\u5b50\u5f39<\/td><td><code>U+2022<\/code><\/td><td><code>disc<\/code><\/td><\/tr><tr><td>\u2023<\/td><td>\u4e09\u89d2\u5b50\u5f39<\/td><td><code>U+2023<\/code><\/td><td><\/td><\/tr><tr><td>\u0336<\/td><td>\u8fde\u5b57\u7b26\u9879\u76ee\u7b26\u53f7<\/td><td><code>U+2043<\/code><\/td><td><\/td><\/tr><tr><td>\u204c<\/td><td>\u9ed1\u8272\u5411\u5de6\u5b50\u5f39<\/td><td><code>U+204C<\/code><\/td><td><\/td><\/tr><tr><td>\u204d<\/td><td>\u9ed1\u8272\u5411\u53f3\u5b50\u5f39<\/td><td><code>U+204D<\/code><\/td><td><\/td><\/tr><tr><td>\u25d8<\/td><td>\u9006\u5b50\u5f39<\/td><td><code>U+25D8<\/code><\/td><td><\/td><\/tr><tr><td>\u25e6<\/td><td>\u767d\u8272\u5b50\u5f39<\/td><td><code>U+25E6<\/code><\/td><td><code>circle<\/code><\/td><\/tr><tr><td>\u2619<\/td><td>\u53cd\u8f6c\u82b1\u5fc3\u5b50\u5f39<\/td><td><code>U+2619<\/code><\/td><td><\/td><\/tr><tr><td>\u2765<\/td><td>\u65cb\u8f6c\u91cd\u9ed1\u5fc3\u5b50\u5f39<\/td><td><code>U+2765<\/code><\/td><td><\/td><\/tr><tr><td>\u2767<\/td><td>\u65cb\u8f6c\u82b1\u5fc3\u5b50\u5f39<\/td><td><code>U+2767<\/code><\/td><td><\/td><\/tr><tr><td>\u29be<\/td><td>\u5e26\u5706\u5708\u7684\u767d\u8272\u9879\u76ee\u7b26\u53f7<\/td><td><code>U+29BE<\/code><\/td><td><\/td><\/tr><tr><td>\u29bf<\/td><td>\u5e26\u5706\u5708\u7684\u5b50\u5f39<\/td><td><code>U+29BF<\/code><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>&nbsp;CSS<code>square<\/code>\u5173\u952e\u5b57\u5728 Unicode \u4e2d\u6ca1\u6709\u5bf9\u5e94\u7684\u201c\u9879\u76ee\u7b26\u53f7\u201d\u5b57\u7b26\u3002\u6700\u63a5\u8fd1\u7684\u5b57\u7b26\u662f\u9ed1\u8272\u5c0f\u65b9\u5757 (\u25aa\ufe0f) \u8868\u60c5\u7b26\u53f7 (&nbsp;<code>U+25AA<\/code>)\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u8ba9\u6211\u4eec\u770b\u770b\u5f53\u6211\u4eec\u7528<code>list-style-type: \"\u2022\"<\/code>\uff08<code>U+2022<\/code>\u9879\u76ee\u7b26\u53f7\uff09\u66ff\u6362\u9ed8\u8ba4\u5217\u8868\u6807\u8bb0\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002\u8fd9\u4e0e\u9ed8\u8ba4\u9879\u76ee\u7b26\u53f7\u76f8\u540c\uff0c\u56e0\u6b64\u4e0d\u5e94\u8be5\u6709\u4efb\u4f55\u91cd\u5927\u7684\u6e32\u67d3\u5dee\u5f02\u3002\u5728\u6211\u7684\u6d4b\u8bd5\u9875\u9762\u4e0a\uff0c\u6253\u5f00\u8be5<code>list-style-type<\/code>\u9009\u9879\u5e76\u89c2\u5bdf\u6807\u8bb0\u7684\u4efb\u4f55\u53d8\u5316\u3002<\/p>\n\n\n\n<p>\u5982\u60a8\u6240\u89c1\uff0c\u6709\u4e24\u4e2a\u91cd\u5927\u53d8\u5316\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6807\u8bb0\u540e\u4e0d\u518d\u5b58\u5728\u6700\u5c0f\u95f4\u9699\u3002<\/li>\n\n\n\n<li>\u5b50\u5f39\u53d8\u5c0f\u4e86\uff0c\u5c31\u50cf\u662f\u5728\u8f83\u5c0f\u7684 \u4e0b\u6e32\u67d3\u7684\u4e00\u6837<code>font-size<\/code>\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u6839\u636e<a href=\"https:\/\/drafts.csswg.org\/css-counter-styles-3\/#simple-symbolic\">CSS \u8ba1\u6570\u5668\u6837\u5f0f 3 \u7ea7<\/a>\uff0c\u9ed8\u8ba4\u5217\u8868\u6807\u8bb0 (&nbsp;<code>disc<\/code>) \u5e94\u201c\u7c7b\u4f3c\u4e8e \u2022&nbsp;<code>U+2022<\/code>BULLET\u201d\u3002\u6d4f\u89c8\u5668\u4f3c\u4e4e\u4f1a\u589e\u5927\u9ed8\u8ba4\u9879\u76ee\u7b26\u53f7\u7684\u5927\u5c0f\uff0c\u4ee5\u4f7f\u5176\u66f4\u6613\u8bfb\u3002Firefox \u751a\u81f3<code>-moz-bullet-font<\/code>\u4e3a\u6807\u8bb0\u4f7f\u7528\u4e86\u4e00\u79cd\u7279\u6b8a\u5b57\u4f53 \u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/01\/firefox-moz-bullet-font.png?resize=1024%2C612&amp;ssl=1\" alt=\":\u5728\u68c0\u67e5\u5668\u4e2d\u9009\u62e9\u4e86\u6807\u8bb0\u3002\u4f7f\u7528\u7684\u5b57\u4f53\uff1a-moz-bullet-font\u3002\" class=\"wp-image-376755\"\/><figcaption class=\"wp-element-caption\">Firefox \u7684 DOM \u68c0\u67e5\u5668\u4e2d\u7684\u201c\u5b57\u4f53\u201d\u7a97\u683c\u663e\u793a\u4e86\u7279\u6b8a\u5b57\u4f53\u3002<\/figcaption><\/figure>\n\n\n\n<p>\u5c3a\u5bf8\u5c0f\u7684\u95ee\u9898\u53ef\u4ee5\u7528 CSS \u4fee\u590d\u5417\uff1f\u5728\u6211\u7684\u6d4b\u8bd5\u9875\u9762\u4e0a\uff0c\u6253\u5f00\u6807\u8bb0\u6837\u5f0f\uff0c\u5e76\u89c2\u5bdf\u66f4\u6539\u6807\u8bb0\u7684<code>font-size<\/code>\u3001<code>line-height<\/code>\u548c\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u60c5\u51b5\u3002<code>font-family<\/code><\/p>\n\n\n\n<p>\u5982\u60a8\u6240\u89c1\uff0c\u589e\u52a0<code>font-size<\/code>\u4f1a\u5bfc\u81f4\u81ea\u5b9a\u4e49\u6807\u8bb0\u5782\u76f4\u9519\u4f4d\uff0c\u800c\u8fd9\u65e0\u6cd5\u901a\u8fc7\u51cf\u5c11\u6765\u7ea0\u6b63<code>line-height<\/code>\u3002<code>vertical-align<\/code>\u53ef\u4ee5\u8f7b\u677e\u4fee\u590d\u6b64\u95ee\u9898\u7684\u5c5e\u6027\u4e0d\u53d7\u652f\u6301<code>::marker<\/code>\u3002<\/p>\n\n\n\n<p>\u4f46\u662f\u4f60\u6709\u6ca1\u6709\u6ce8\u610f\u5230\uff0c\u6539\u53d8<code>font-family<\/code>\u4f1a\u5bfc\u81f4\u6807\u8bb0\u53d8\u5927\uff1f\u5c1d\u8bd5\u5c06\u5176\u8bbe\u7f6e\u4e3a<code>Tahoma<\/code>\u3002\u8fd9\u53ef\u80fd\u662f\u89e3\u51b3\u5c0f\u5c3a\u5bf8\u95ee\u9898\u7684\u4e00\u4e2a\u8db3\u591f\u597d\u7684\u65b9\u6cd5\uff0c\u5c3d\u7ba1\u6211\u8fd8\u6ca1\u6709\u6d4b\u8bd5\u54ea\u79cd\u5b57\u4f53\u5728\u4e3b\u6d41\u6d4f\u89c8\u5668\u548c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u6548\u679c\u6700\u597d\u3002<\/p>\n\n\n\n<p>\u60a8\u53ef\u80fd\u8fd8\u6ce8\u610f\u5230\uff0c\u5f53\u60a8\u5c06\u6807\u8bb0\u653e\u7f6e\u5728\u5217\u8868\u9879\u5185\u65f6\uff0cChromium \u9519\u8bef\u4e0d\u518d\u53d1\u751f\u3002\u8fd9\u610f\u5473\u7740\u81ea\u5b9a\u4e49\u6807\u8bb0\u53ef\u4ee5\u4f5c\u4e3a\u6b64\u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5\u3002\u8fd9\u8ba9\u6211\u60f3\u5230\u4e86\u4e3b\u8981\u95ee\u9898\uff0c\u4e5f\u662f\u6211\u5f00\u59cb\u7814\u7a76\u8fd9\u4e2a\u4e3b\u9898\u7684\u539f\u56e0\u3002<strong>\u5982\u679c\u60a8\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6807\u8bb0\u5e76\u5c06\u5176\u653e\u7f6e\u5728\u5217\u8868\u9879\u5185\uff0c\u5219\u6807\u8bb0\u540e\u6ca1\u6709\u95f4\u9699\uff0c\u4e5f\u65e0\u6cd5\u901a\u8fc7\u6807\u51c6\u65b9\u5f0f\u63d2\u5165\u95f4\u9699\u3002<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u81ea\u5b9a\u4e49\u6807\u8bb0\u540e\u6ca1\u6709\u6700\u5c0f\u95f4\u9699\u3002<\/li>\n\n\n\n<li><code>::marker<\/code>\u4e0d\u652f\u6301<code>padding<\/code>\u6216<code>margin<\/code>\u3002<\/li>\n\n\n\n<li><code>padding-left<\/code>\u7531\u4e8e\u6807\u8bb0\u7684\u4f4d\u7f6e\u4e3a \uff0c\u56e0\u6b64<code>&lt;li><\/code>\u4e0d\u4f1a\u589e\u52a0\u95f4\u9699<code>inside<\/code>\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"summary\"><a href=\"https:\/\/css-tricks.com\/everything-you-need-to-know-about-the-gap-after-the-list-marker\/#aa-summary\"><\/a>\u6982\u62ec<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u6211\u5728\u6587\u7ae0\u4e2d\u63d0\u5230\u7684\u6240\u6709\u5173\u952e\u4e8b\u5b9e\u7684\u6458\u8981\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>padding-inline-start<\/code>\u6d4f\u89c8\u5668\u5bf9\u548c\u5143\u7d20\u5e94\u7528\u9ed8\u8ba4\u7684<code>40px<\/code>\u3002<code>&lt;ul><\/code><code>&lt;ol><\/code><\/li>\n\n\n\n<li>\u5185\u7f6e\u5217\u8868\u6807\u8bb0 (\u00a0<code>disc<\/code>\u3001<code>decimal<\/code>\u7b49) \u540e\u6709\u6700\u5c0f\u95f4\u9699\u3002\u81ea\u5b9a\u4e49\u6807\u8bb0 (\u5b57\u7b26\u4e32\u6216 URL) \u540e\u65e0\u6700\u5c0f\u95f4\u9699\u3002<\/li>\n\n\n\n<li><code>padding-left<\/code>\u53ef\u4ee5\u901a\u8fc7\u5728\u4e2d\u6dfb\u52a0 \u6765\u589e\u52a0\u95f4\u9699\u7684\u957f\u5ea6<code>&lt;ul><\/code>\uff0c\u4f46\u524d\u63d0\u662f\u6807\u8bb0\u4f4d\u4e8e\u5217\u8868\u9879\u4e4b\u5916\uff08\u9ed8\u8ba4\u6a21\u5f0f\uff09\u3002<\/li>\n\n\n\n<li>\u81ea\u5b9a\u4e49\u5b57\u7b26\u4e32\u6807\u8bb0\u7684\u9ed8\u8ba4\u5927\u5c0f\u6bd4\u5185\u7f6e\u6807\u8bb0\u5c0f\u3002\u66f4\u6539<code>font-family<\/code>\u53ef\u4ee5<code>::marker<\/code>\u589e\u52a0\u5176\u5927\u5c0f\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"conclusion\"><a href=\"https:\/\/css-tricks.com\/everything-you-need-to-know-about-the-gap-after-the-list-marker\/#aa-conclusion\"><\/a>\u7ed3\u8bba<\/h3>\n\n\n\n<p>\u56de\u987e\u6587\u7ae0\u5f00\u5934\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u6211\u60f3\u6211\u73b0\u5728\u660e\u767d\u4e86\u4e3a\u4ec0\u4e48\u503c\u4e2d\u6709\u4e00\u4e2a\u7a7a\u683c\u5b57\u7b26<code>content<\/code>\u3002\u6ca1\u6709\u66f4\u597d\u7684\u65b9\u6cd5\u53ef\u4ee5\u5728 SVG \u6807\u8bb0\u540e\u63d2\u5165\u95f4\u9699\u3002\u8fd9\u662f\u4e00\u79cd\u5fc5\u8981\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u56e0\u4e3a\u65e0\u8bba\u591a\u5c11\u4e2a<code>margin<\/code>\u548c<code>padding<\/code>\u90fd\u65e0\u6cd5\u5728\u4f4d\u4e8e\u5217\u8868\u9879\u5185\u7684\u81ea\u5b9a\u4e49\u6807\u8bb0\u540e\u521b\u5efa\u95f4\u9699\u3002<code>margin-right<\/code>on<code>::marker<\/code>\u53ef\u4ee5\u8f7b\u677e\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u4f46\u4e0d\u652f\u6301\u8fd9\u6837\u505a\u3002<\/p>\n\n\n\n<p>\u5728<code>::marker<\/code>\u6dfb\u52a0\u5bf9\u66f4\u591a\u5c5e\u6027\u7684\u652f\u6301\u4e4b\u524d\uff0cWeb \u5f00\u53d1\u4eba\u5458\u901a\u5e38\u522b\u65e0\u9009\u62e9\uff0c\u53ea\u80fd\u9690\u85cf\u6807\u8bb0\u5e76\u4f7f\u7528<code>::before<\/code>\u4f2a\u5143\u7d20\u6a21\u62df\u5b83\u3002\u6211\u6700\u8fd1\u4e0d\u5f97\u4e0d\u81ea\u5df1\u8fd9\u6837\u505a\uff0c\u56e0\u4e3a\u6211\u65e0\u6cd5\u66f4\u6539\u6807\u8bb0\u7684<code>background-color<\/code>\u3002\u5e0c\u671b\u6211\u4eec\u4e0d\u5fc5\u7b49\u5f85\u592a\u4e45\u624d\u80fd\u770b\u5230\u66f4\u5f3a\u5927\u7684<code>::marker<\/code>\u4f2a\u5143\u7d20\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u5728\u9605\u8bfbGoogle \u7684 web.dev \u535a\u5ba2\u4e0a\u7684\u201c\u521b\u610f\u5217\u8868\u6837\u5f0f\u201d\uff0c\u5e76\u6ce8\u610f\u5230\u6587\u7ae0&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-css","wpcat-5-id"],"_links":{"self":[{"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":1,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yikepi.com\/index.php\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}