{"id":9429,"date":"2020-05-27T23:50:42","date_gmt":"2020-05-27T15:50:42","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429"},"modified":"2020-05-28T10:08:29","modified_gmt":"2020-05-28T02:08:29","slug":"css-columns-justify-content","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/05\/css-columns-justify-content\/","title":{"rendered":"CSS columns\u8f7b\u677e\u5b9e\u73b0\u4e24\u7aef\u5bf9\u9f50\u5e03\u5c40\u6548\u679c"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429<\/a><br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202005-columns-space-between.jpg';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202005\/rains-house.jpg\" width=\"460\" height=\"303\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u515c\u515c\u8f6c\u8f6c\u4e00\u5927\u5708<\/h3>\n<p>\u515c\u515c\u8f6c\u8f6c\u4e00\u5927\u5708\uff0c\u6700\u540e\u53d1\u73b0\u5b9e\u73b0\u4e24\u7aef\u5bf9\u9f50\u5e03\u5c40\u65b9\u5f0f\u6700\u7b80\u5355\u7684\u5c45\u7136\u662f\u4f7f\u7528CSS columns\u591a\u680f\u5e03\u5c40\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u60f3\u8981\u5b9e\u73b03\u5217\u5143\u7d20\u4e24\u7aef\u5bf9\u9f50\uff0c\u4e2d\u95f4\u95f4\u9699\u662f30px\uff0cCSS\u4ee3\u7801\u4e3a\uff1a<\/p>\n<pre>.container {\r\n    columns: 3;\r\n    column-gap: 30px;\r\n    <span style=\"color:green;\">\/* \u4e5f\u53ef\u4ee5\u662fgap: 30px *\/<\/span>\r\n}<\/pre>\n<p>\u53ee\u549a\uff0c\u7ed3\u675f\u4e86\uff0cgame over~<\/p>\n<p>\u7b80\u5355\u5230\u4ee4\u4eba\u53d1\u6307\u3002<\/p>\n<p>\u4e0d\u8981\u6000\u7591\uff0c\u770b\u4e00\u4e2a\u5b9e\u65f6\u6e32\u67d3\u7684\u4f8b\u5b50\u5427\uff1a<\/p>\n<pre>&lt;div class=\"container\"&gt;\r\n    &lt;div class=\"zhang\"&gt;&lt;\/div&gt;\r\n    &lt;div class=\"xin\"&gt;&lt;\/div&gt;\r\n    &lt;div class=\"xu\"&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<pre>.container {\r\n    columns: 3;\r\n    column-gap: 30px;\r\n}\r\n.container &gt; div {\r\n    padding: 50px;\r\n    background: deepskyblue;\r\n}<\/pre>\n<p>\u5b9e\u65f6\u6e32\u67d3\u6548\u679c\u5982\u4e0b\uff0c\u5982\u679c\u6ca1\u6548\u679c\uff0c\u8bf7\u8bbf\u95ee<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429\">\u539f\u6587\u5730\u5740<\/a>\u3002<span class=\"hidden\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429<\/span><\/p>\n<style>.container {\n    columns: 3;\n    column-gap: 30px;\n}\n.container > div {\n    padding: 50px;\n    background: deepskyblue;\n}<\/style>\n<div class=\"container\">\n<div class=\"zhang\"><\/div>\n<div class=\"xin\"><\/div>\n<div class=\"xu\"><\/div>\n<\/div>\n<h3>\u4e8c\u3001columns\u5b9e\u73b0\u7684\u4f18\u7f3a\u70b9<\/h3>\n<h4>\u4f18\u70b9<\/h4>\n<p>\u76f8\u6bd4Flex\u5e03\u5c40\u548cGrid\u5e03\u5c40\u7684space-between\u503c\u7684\u4e24\u7aef\u5bf9\u9f50\u6548\u679c\uff0c\u4f7f\u7528CSS columns\u5e03\u5c40\u5b9e\u73b0\u7684\u4f18\u70b9\u9664\u4e86\u4ee3\u7801\u5c11\u4e86\u4e00\u70b9\u4e4b\u5916\uff0c\u6700\u5927\u7684\u4f18\u70b9\u662f\u4fdd\u62a4\u4e86HTML\u5143\u7d20\u539f\u672c\u7684<code>display<\/code>\u8ba1\u7b97\u503c\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6d4f\u89c8\u5668\u9ed8\u8ba4\u72b6\u6001\u4e0b\uff0c<code>&lt;li&gt;<\/code>\u5143\u7d20\u4f1a\u51fa\u73b0\u9879\u76ee\u7b26\u53f7\uff0c\u4f8b\u5982\u5706\u70b9\uff0c\u6216\u6570\u5b57\u5e8f\u53f7\u3002<\/p>\n<p>\u5982\u679c\u4f7f\u7528Flex\u5e03\u5c40\u6216Grid\u5e03\u5c40\uff0c\u5c31\u9700\u8981\u8bbe\u7f6e<code>display:flex<\/code>\u6216\u8005<code>display:grid<\/code>\uff0c\u6539\u53d8\u4e86\u539f\u59cb\u7684<code>display:list-item<\/code>\u8ba1\u7b97\u503c\uff0c\u5706\u70b9\uff0c\u6216\u6570\u5b57\u5e8f\u53f7\u5c31\u4f1a\u6d88\u5931\u3002<\/p>\n<p>\u9488\u5bf9\u8fd9\u4e2a\u4f18\u70b9\uff0c\u6211\u505a\u4e86\u4e2ademo\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202005\/css-columns-justify-space-between-demo.php\" rel=\"noopener\" target=\"_blank\">list-style-type\u4fdd\u7559\u540c\u65f6columns\u4e24\u7aef\u5bf9\u9f50demo<\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u5230<code>&lt;li&gt;<\/code>\u5143\u7d20\u5b50\u5143\u7d20\u65e2\u4fdd\u6301\u4e86\u4e24\u7aef\u5bf9\u9f50\u6548\u679c\uff0c<code>&lt;li&gt;<\/code>\u5143\u7d20\u81ea\u8eab\u9ed8\u8ba4\u81ea\u5e26\u7684\u5706\u70b9\u7b26\u53f7\u4e5f\u4fdd\u7559\u4e86\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202005\/2020-05-27_233300.png\" width=\"420\" height=\"442\" alt=\"\u9879\u76ee\u7b26\u53f7\u70b9\u4f9d\u65e7\u4fdd\u7559\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u8fd9\u662fFlex\u5e03\u5c40\u548cGrid\u5e03\u5c40\u65e0\u6cd5\u8f7b\u677e\u5b9e\u73b0\u7684\u3002<\/p>\n<h4>\u7f3a\u70b9<\/h4>\n<p>\u9002\u5408\u5355\u884c\u5143\u7d20\u7684\u4e24\u7aef\u5bf9\u9f50\u6548\u679c\uff0c\u5982\u679c\u5217\u8868\u5143\u7d20\u6709\u5f88\u591a\u884c\uff0c\u5219columns\u5e03\u5c40\u5c31\u4e0d\u592a\u597d\u5904\u7406\uff0c\u4e00\u662f\u5217\u8868\u7684\u6d41\u5411\u4f18\u5148\u5782\u76f4\u65b9\u5411\uff0c\u4e8c\u662f\u5bb9\u6613\u51fa\u73b0\u5217\u8868\u5782\u76f4\u5206\u5217\u7684\u610f\u5916\u573a\u666f\u3002<\/p>\n<h3>\u4e09\u3001\u7ed3\u8bed<\/h3>\n<p>CSS columns\u5b9e\u73b0\u4e24\u7aef\u5e03\u5c40\u6548\u679c\u867d\u7136\u5728\u5b9e\u9645\u5f00\u53d1\u7684\u65f6\u5019\u4e0d\u5b9e\u7528\uff0c\u56e0\u4e3a\u8fd8\u662f\u6709\u4e0d\u5c11\u9650\u5236\u7684\u3002<\/p>\n<p>\u552f\u4e00\u9002\u5408\u7684\u573a\u666f\uff0c\u5c31\u662f\u4e0d\u6539\u53d8display\u503c\u540c\u65f6\u5b9e\u73b0\u4e24\u7aef\u5e03\u5c40\u6548\u679c\u7684\u65f6\u5019\uff0c\u867d\u7136\u8fd9\u6837\u7684\u573a\u666f\u6bd4\u8f83\u5c11\uff0c\u4f46\u662f\u5b9e\u9645\u5f00\u53d1\u9879\u76ee\u90a3\u4e48\u591a\uff0c\u4f7f\u7528\u573a\u666f\u5343\u5343\u4e07\uff0c\u96be\u4fdd\u4ec0\u4e48\u65f6\u5019\u4f1a\u9047\u5230\uff0c\u6b64\u65f6\uff0c\u7528\u4e0a\u77ed\u77ed<code>columns:3;gap:30px;<\/code>\u51e0\u4e2a\u5b57\u6bcd\u5c31\u5b9e\u73b0\u7cbe\u6e5b\u7684\u5e03\u5c40\u6548\u679c\uff0c\u5c82\u4e0d\u723d\u54c9\uff01<\/p>\n<p>\u5176\u5b9e\u6280\u672f\u5c31\u662f\u8fd9\u6837\uff0c\u51e0\u4e4e\u5f88\u5c11\u6709\u6ca1\u6709\u4f5c\u7528\uff0c\u5b8c\u5168\u9e21\u808b\u7684API\u7684\uff0c\u5b58\u5728\u5c31\u6709\u9053\u7406\uff0c\u51fa\u73b0\u5373\u6709\u4ef7\u503c\uff0c\u53ea\u662f\u5176\u4f7f\u7528\u7684\u573a\u666f\u662f\u5e94\u5bf9\u975e\u5178\u578b\u573a\u666f\u7684\u3002<\/p>\n<p>\u5b66\u4e60\u4e4b\uff0c\u4e86\u89e3\u4e4b\uff0c\u83b7\u53d6\u77ed\u65f6\u95f4\u770b\u4e0d\u5230\u6548\u679c\uff0c\u4f46\u662f\u968f\u7740\u9879\u76ee\u7ecf\u9a8c\u4e0d\u65ad\u79ef\u7d2f\uff0c\u4e00\u5b9a\u4f1a\u9047\u5230\u4f7f\u7528\u9002\u5408\u7684\u4f7f\u7528\u573a\u666f\u7684\uff0c\u522b\u4eba\u8fd8\u4f1a\u5934\u75bc\u600e\u4e48\u5b9e\u73b0\uff0c\u8fd8\u5728\u4e0d\u65ad\u7684\u8c37\u6b4c\u641c\u7d22\uff0c\u800c\u4f60\uff0c\u4e00\u4e2a\u95ea\u5ff5\u7684\u65f6\u95f4\uff0c\u804a\u804a\u6570\u884c\u4ee3\u7801\uff0c\u5c31\u5b9e\u73b0\u4e86\u8fd9\u6837\u7684\u9700\u6c42\uff0c\u90a3\u79cd\u611f\u89c9\uff0c\u4f1a\u8ba9\u4f60\u4e0a\u763e\u7684\uff0c\u4ec0\u4e48\u611f\u89c9\u5462\uff1f\u5c31\u662f\u6280\u672f\u4e16\u754c\u7684\u638c\u63a7\u8005\uff0c\u4fef\u77b0\u82b8\u82b8\u4ee3\u7801\uff0c\u4ee3\u7801\u4e16\u754c\u4e00\u4eba\u4e4b\u4e0b\u4e07\u4eba\u4e4b\u4e0a\u7684\u611f\u89c9\uff0c\u672c\u8d28\u4e0a\u662f\u4e00\u79cd\u638c\u63a7\u6743\u529b\u7684\u611f\u89c9\uff0c\u662f\u6210\u4e3a\u6280\u672f\u9ad8\u624b\u7684\u611f\u89c9\u3002<\/p>\n<p>\u6240\u4ee5\uff0cCSS columns\u5b9e\u73b0\u4e24\u7aef\u5e03\u5c40\uff0c\u867d\u51fa\u573a\u673a\u4f1a\u4e0d\u9519\uff0c\u4f46\u672c\u8eab\u4ef7\u503c\u5e76\u4e0d\u4f4e\u3002<\/p>\n<p>\u597d\uff0c\u672c\u6587\u6280\u672f\u96be\u5ea6\u5230\u6ca1\u4ec0\u4e48\uff0c\u4e3b\u8981\u662f\u4e00\u4e2a\u5e03\u5c40\u5c0ftips\u5171\u4eab\u3002<\/p>\n<p>\u5982\u679c\u4f60\u89c9\u5f97\u8fd9\u4e2a\u5e03\u5c40\u5b9e\u73b0\u8fd8\u4e0d\u9519\uff0c\u6b22\u8fce\u5206\u4eab\u7ed9\u5176\u4ed6\u5c0f\u4f19\u4f34\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f60f.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9429<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202005\/rains-house.jpg\" width=\"160\" height=\"105\" class=\"alignright size-medium\" \/><\/p>\n<p>CSS columns\uff0c\u5c31\u662f\u5206\u680f\u5e03\u5c40\u7684columns\u5c5e\u6027\uff0c\u53ef\u4ee5\u5728\u4e0d\u6539\u53d8\u5143\u7d20display\u503c\u524d\u63d0\u4e0b\u5b9e\u73b0\u4e24\u7aef\u5bf9\u9f50\u5e03\u5c40\u6548\u679c\uff0c\u8bf4\u4e0d\u5b9a\u5173\u952e\u65f6\u5019\u8fd8\u662f\u5f88\u6709\u7528\u7684\uff0c\u53ef\u4ee5\u6765\u4e86\u89e3\u4e0b\u8fd9\u79cdCSS\u5e03\u5c40\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1404,1102,1271,1515,1618,1514,1619,284,282,580],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9429"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=9429"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9429\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=9429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=9429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=9429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}