{"id":8063,"date":"2018-10-28T22:01:57","date_gmt":"2018-10-28T14:01:57","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063"},"modified":"2025-04-03T11:17:53","modified_gmt":"2025-04-03T03:17:53","slug":"display-flex-css3-css","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2018\/10\/display-flex-css3-css\/","title":{"rendered":"\u5199\u7ed9\u81ea\u5df1\u770b\u7684display: flex\u5e03\u5c40\u6559\u7a0b"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u4f46\u9700\u5f97\u5230\u539f\u4f5c\u8005\u4e66\u9762\u8bb8\u53ef\uff0c\u540c\u65f6\u4fdd\u7559\u539f\u4f5c\u8005\u548c\u51fa\u5904\uff0c\u6458\u8981\u5f15\u6d41\u5219\u968f\u610f\u3002<\/p>\n<style>html,body{scroll-behavior:smooth}.params_table{font-size:14px;}.params_table tr:hover{opacity:1}.flex{display:flex;max-width:414px;outline:1px dotted;background-color:#fff}.flex>div[data-index]{background:radial-gradient(circle, #ffffff, #DBEAFE 70%, #98C5FE)}.flex>div[data-index]::before{content:attr(data-index);background-color:#cd0000;color:#fff;position:absolute;border-radius:50%;width:20px;height:20px;font-size:14px;text-align:center;line-height:20px;z-index:1}.mxw-none img{max-width:none}p .ui-radio,p .ui-checkbox{margin-right:5px}.flex-dl dt{font-weight:bold;font-family:x-locale-heading-primary,zillaslab,Palatino,\"Palatino Linotype\",x-locale-heading-secondary,Source Han Serif SC,STZhongsong,simsun,serif}.flex-test-x{padding:1px 10px 20px;background-color:#f0f3f9}.check-group{display:inline-block}.flex-grow > div{flex-grow:.25}@media all and (max-width:640px){.flex-test-x{margin-left:-13px;margin-right:-15px;padding-left:13px;padding-right:15px}}@media all and (max-width:375px){#flexDirection [data-index=\"3\"]{display:none}}<\/style>\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"\/sp\/lulu\/theme\/peak\/css\/common\/ui\/Radio.css\">\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"\/sp\/lulu\/theme\/peak\/css\/common\/ui\/Checkbox.css\">\n<p><span class=\"s\">\/\/zxx: \u672c\u6559\u7a0b\u6240\u6709\u5e03\u5c40\u6548\u679c\uff08\u542b\u4ea4\u4e92\uff09\u4e3a\u5b9e\u65f6\u6e32\u67d3\uff0c\u82e5\u5e03\u5c40\u5f02\u5e38\uff0c\u53ef\u4ee5<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063\" rel=\"noopener\" target=\"_blank\">\u70b9\u51fb\u8fd9\u91cc<\/a>\u8bbf\u95ee\u539f\u6587\u3002<\/span><\/p>\n<h3>\u4e00\u3001\u524d\u8a00&amp;\u7d22\u5f15<\/h3>\n<p>\u7ed9div\u8fd9\u7c7b\u5757\u72b6\u5143\u7d20\u5143\u7d20\u8bbe\u7f6e<code>display:flex<\/code>\u6216\u8005\u7ed9span\u8fd9\u7c7b\u5185\u8054\u5143\u7d20\u8bbe\u7f6e<code>display:inline-flex<\/code>\uff0cflex\u5e03\u5c40\u5373\u521b\u5efa\uff01\u5176\u4e2d\uff0c\u76f4\u63a5\u8bbe\u7f6e<code>display:flex<\/code>\u6216\u8005<code>display:inline-flex<\/code>\u7684\u5143\u7d20\u79f0\u4e3aflex\u5bb9\u5668\uff0c\u91cc\u9762\u7684\u5b50\u5143\u7d20\u79f0\u4e3aflex\u5b50\u9879\u3002<\/p>\n<p><span class=\"s\">\/\/zxx: flex\u548cinline-flex\u533a\u522b\u5728\u4e8e\uff0cinline-flex\u5bb9\u5668\u4e3ainline\u7279\u6027\uff0c\u56e0\u6b64\u53ef\u4ee5\u548c\u56fe\u7247\u6587\u5b57\u4e00\u884c\u663e\u793a\uff1bflex\u5bb9\u5668\u4fdd\u6301\u5757\u72b6\u7279\u6027\uff0c\u5bbd\u5ea6\u9ed8\u8ba4100%\uff0c\u4e0d\u548c\u5185\u8054\u5143\u7d20\u4e00\u884c\u663e\u793a\u3002<\/span><\/p>\n<p>\u800cFlex\u5e03\u5c40\u76f8\u5173\u5c5e\u6027\u6b63\u597d\u5206\u4e3a\u4e24\u62e8\uff0c\u4e00\u62e8\u4f5c\u7528\u5728flex\u5bb9\u5668\u4e0a\uff0c\u8fd8\u6709\u4e00\u62e8\u4f5c\u7528\u5728flex\u5b50\u9879\u4e0a\u3002\u5177\u4f53\u53c2\u89c1\u4e0b\u8868\uff0c\u70b9\u51fb\u53ef\u5feb\u901f\u7d22\u5f15\u3002<\/p>\n<table border=\"0\" width=\"100%\" class=\"params_table\" cellspacing=\"1\" style=\"max-width:400px;\">\n<thead>\n<tr>\n<th>\u4f5c\u7528\u5728flex\u5bb9\u5668\u4e0a<\/th>\n<th>\u4f5c\u7528\u5728flex\u5b50\u9879\u4e0a<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<ul>\n<li><a href=\"#flex-direction\" title=\"\u63a7\u5236\u6240\u6709\u5b50\u9879\u6574\u4f53\u5e03\u5c40\u65b9\u5411\uff0c\u662f\u4ece\u5de6\u5f80\u53f3\u8fd8\u662f\u4ece\u53f3\u5f80\u5de6\u4e4b\u7c7b\">flex-direction<\/a><\/li>\n<li><a href=\"#flex-wrap\" title=\"\u63a7\u5236\u6240\u6709\u5b50\u9879\u662f\u5426\u6362\u884c\u7b49\u5e03\u5c40\u8868\u73b0\">flex-wrap<\/a><\/li>\n<li><a href=\"#flex-flow\" title=\"\u662fflex-direction\u548cflex-flow\u7684\u7f29\u5199\">flex-flow<\/a><\/li>\n<li><a href=\"#justify-content\" title=\"\u63a7\u5236\u6240\u6709\u5b50\u9879\u6c34\u5e73\u5bf9\u9f50\u65b9\u5f0f\uff0c\u7c7b\u4f3c\u4e24\u7aef\u5bf9\u9f50\u8fd8\u662f\u5c45\u4e2d\u5bf9\u9f50\">justify-content<\/a><\/li>\n<li><a href=\"#align-items\" title=\"\u63a7\u5236\u6240\u6709\u5b50\u9879\u7684\u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f\uff0c\u4f8b\u5982\u9876\u5bf9\u9f50\u8fd8\u662f\u5e95\u5bf9\u9f50\">align-items<\/a><\/li>\n<li><a href=\"#align-content\" title=\"\u5f53\u5b50\u9879\u8d85\u8fc7\u4e00\u884c\u7684\u65f6\u5019\uff0c\u63a7\u5236\u6574\u4f53\u7684\u5782\u76f4\u5206\u5e03\u65b9\u5f0f\uff0c\u4f8b\u5982\u7b49\u5206\u6216\u8005\u62c9\u4f38\u7b49\">align-content<\/a><\/li>\n<\/ul>\n<\/td>\n<td>\n<ul>\n<li><a href=\"#flex-order\" title=\"\u53ef\u4ee5\u63a7\u5236\u5355\u4e2a\u5b50\u9879\u7684\u6240\u5728\u7684\u4f4d\u7f6e\">order<\/a><\/li>\n<li><a href=\"#flex-grow\" title=\"\u63a7\u5236\u5355\u4e2a\u5b50\u9879\u5360\u636e\u7a7a\u95f4\u6bd4\u4f8b\">flex-grow<\/a><\/li>\n<li><a href=\"#flex-shrink\" title=\"\u7a7a\u95f4\u4e0d\u8db3\u65f6\u5019\u5b50\u9879\u7f29\u5c0f\u7684\u6bd4\u4f8b\">flex-shrink<\/a><\/li>\n<li><a href=\"#flex-basis\" title=\"\u5b9a\u4e49\u5b50\u9879\u5360\u636e\u7684\u5bbd\u5ea6\">flex-basis<\/a><\/li>\n<li><a href=\"#flex-flex\" title=\"\u662fflex-grow\uff0cflex-shrink\u548cflex-basis\u7684\u7f29\u5199\">flex<\/a><\/li>\n<li><a href=\"#align-self\" title=\"\u5b9a\u4e49\u5b50\u9879\u7684\u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f\">align-self<\/a><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u65e0\u8bba\u4f5c\u7528\u5728flex\u5bb9\u5668\u4e0a\uff0c\u8fd8\u662f\u4f5c\u7528\u5728flex\u5b50\u9879\uff0c\u90fd\u662f\u63a7\u5236\u7684flex\u5b50\u9879\u7684\u5448\u73b0\uff0c\u53ea\u662f\u524d\u8005\u63a7\u5236\u7684\u662f\u6574\u4f53\uff0c\u540e\u8005\u63a7\u5236\u7684\u662f\u4e2a\u4f53\u3002<\/p>\n<p><strong>\u5176\u4ed6\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li>\u672c\u6559\u7a0b\u6240\u6709\u6848\u4f8bHTML\u7ed3\u6784\u4e3a\uff1a\n<pre>container(flex\u5bb9\u5668)\r\n  div(flex\u5b50\u9879) > img\r\n  div(flex\u5b50\u9879) > img\r\n  div(flex\u5b50\u9879) > img<\/pre>\n<p>\u540c\u65f6\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u533a\u5206\uff0cflex\u5bb9\u5668\u533a\u57df\u4f7f\u7528\u865a\u6846\u6807\u793a\uff0cflex\u5b50\u9879\u589e\u52a0\u4e86\u767d\u84dd\u5f84\u5411\u6e10\u53d8\u80cc\u666f\u8272\uff0c\u56fe\u7247\u4e0a\u663e\u793a\u4e86\u539f\u59cb\u5e8f\u53f7\u3002<\/li>\n<li>Flex\u5e03\u5c40\u4e2d\u8fd8\u6709\u4e3b\u8f74\u548c\u4ea4\u53c9\u8f74\u7684\u6982\u5ff5\uff0c\u4e3a\u907f\u514d\u8fc7\u591a\u6982\u5ff5\u5e72\u6270\uff0c\u672c\u6559\u7a0b\u7701\u7565\u76f8\u5173\u63aa\u8f9e\uff0c\u800c\u662f\u4f7f\u7528\u6c34\u5e73\u65b9\u5411\u548c\u5782\u76f4\u65b9\u5411\u4ee3\u66ff<sup>\u2460<\/sup>\u3002\n<p><span class=\"s\">\/\/zxx: \u2460 writing-mode\u5c5e\u6027\u53ef\u4ee5\u6539\u53d8\u6587\u6863\u6d41\u65b9\u5411\uff0c\u6b64\u65f6\u4e3b\u8f74\u662f\u5782\u76f4\u65b9\u5411\uff0c\u4f46\u5b9e\u9645\u5f00\u53d1\u5f88\u5c11\u9047\u5230\u8fd9\u6837\u573a\u666f\uff0c\u56e0\u6b64\uff0c\u521d\u5b66\u7684\u65f6\u5019\uff0c\u76f4\u63a5\u4f7f\u7528\u6c34\u5e73\u65b9\u5411\u548c\u5782\u76f4\u65b9\u5411\u7406\u89e3\u4e0d\u4f1a\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u53cd\u800c\u6613\u4e8e\u7406\u89e3\u3002<\/span><\/li>\n<\/ul>\n<h3>\u4e8c\u3001\u4f5c\u7528\u5728flex\u5bb9\u5668\u4e0a\u7684CSS\u5c5e\u6027<\/h3>\n<h4 id=\"flex-direction\">1. flex-direction<\/h4>\n<p><code>flex-direction<\/code>\u7528\u6765\u63a7\u5236\u5b50\u9879\u6574\u4f53\u5e03\u5c40\u65b9\u5411\uff0c\u662f\u4ece\u5de6\u5f80\u53f3\u8fd8\u662f\u4ece\u53f3\u5f80\u5de6\uff0c\u662f\u4ece\u4e0a\u5f80\u4e0b\u8fd8\u662f\u4ece\u4e0b\u5f80\u4e0a\u3002\u548cCSS\u7684<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2016\/03\/css-direction-introduction-apply\/\">direction\u5c5e\u6027<\/a>\u76f8\u6bd4\u5c31\u662f\u591a\u4e86\u4e2a<code>flex<\/code>\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>flex-direction: row | row-reverse | column | column-reverse;<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl class=\"flex-dl\">\n<dt>row<\/dt>\n<dd>\u9ed8\u8ba4\u503c\uff0c\u663e\u793a\u4e3a\u884c\u3002\u65b9\u5411\u4e3a\u5f53\u524d\u6587\u6863\u6c34\u5e73\u6d41\u65b9\u5411\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u4ece\u5de6\u5f80\u53f3\u3002\u5982\u679c\u5f53\u524d\u6c34\u5e73\u6587\u6863\u6d41\u65b9\u5411\u662f<code>rtl<\/code>\uff08\u5982\u8bbe\u7f6e<code>direction:rtl<\/code>\uff09\uff0c\u5219\u4ece\u53f3\u5f80\u5de6\u3002<\/dd>\n<dt>row-reverse<\/dt>\n<dd>\u663e\u793a\u4e3a\u884c\u3002\u4f46\u65b9\u5411\u548c<code>row<\/code>\u5c5e\u6027\u503c\u662f\u53cd\u7684\u3002<\/dd>\n<dt>column<\/dt>\n<dd>\u663e\u793a\u4e3a\u5217\u3002<\/dd>\n<dt>column-reverse<\/dt>\n<dd>\u663e\u793a\u4e3a\u5217\u3002\u4f46\u65b9\u5411\u548c<code>column<\/code>\u5c5e\u6027\u503c\u662f\u53cd\u7684\u3002<\/dd>\n<\/dl>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u70b9\u51fb\u4e0b\u9762\u5bf9\u5e94\u5355\u9009\u9879\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u5e03\u5c40\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexDir1\" name=\"flexDirection\" value=\"row\" checked><label for=\"flexDir1\" class=\"ui-radio\"><\/label><label for=\"flexDir1\" class=\"mr20\">row<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexDir2\" name=\"flexDirection\" value=\"row-reverse\"><label for=\"flexDir2\" class=\"ui-radio\"><\/label><label for=\"flexDir2\" class=\"mr20\">row-reverse<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexDir3\" name=\"flexDirection\" value=\"column\"><label for=\"flexDir3\" class=\"ui-radio\"><\/label><label for=\"flexDir3\" class=\"mr20\">column<\/label> <input type=\"radio\" id=\"flexDir4\" name=\"flexDirection\" value=\"column-reverse\"><label for=\"flexDir4\" class=\"ui-radio\"><\/label><label for=\"flexDir4\">column-reverse<\/label><\/span><\/p>\n<div class=\"flex\" id=\"flexDirection\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\"><\/div>\n<\/div>\n<\/div>\n<h4 id=\"flex-wrap\">2. flex-wrap<\/h4>\n<p><code>flex-wrap<\/code>\u7528\u6765\u63a7\u5236\u5b50\u9879\u6574\u4f53\u5355\u884c\u663e\u793a\u8fd8\u662f\u6362\u884c\u663e\u793a\uff0c\u5982\u679c\u6362\u884c\uff0c\u5219\u4e0b\u9762\u4e00\u884c\u662f\u5426\u53cd\u65b9\u5411\u663e\u793a\u3002\u8fd9\u4e2a\u5c5e\u6027\u6bd4\u8f83\u597d\u8bb0\u5fc6\uff0c\u5728CSS\u4e16\u754c\u4e2d\uff0c\u53ea\u8981\u770b\u5230\u5355\u8bcdwrap\u4e00\u5b9a\u662f\u4e0e\u6362\u884c\u663e\u793a\u76f8\u5173\u7684\uff0c<code>word-wrap<\/code>\u5c5e\u6027\u6216\u8005<code>white-space:nowrap<\/code>\u6216\u8005<code>pre-wrap<\/code>\u4e4b\u7c7b\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>flex-wrap: nowrap | wrap | wrap-reverse;<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl class=\"flex-dl\">\n<dt>nowrap<\/dt>\n<dd>\u9ed8\u8ba4\u503c\uff0c\u8868\u793a\u5355\u884c\u663e\u793a\uff0c\u4e0d\u6362\u884c\u3002\u4e8e\u662f\u5f88\u5bb9\u6613\u51fa\u73b0\u5bbd\u5ea6\u6ea2\u51fa\u7684\u573a\u666f\uff0c\u5176\u6e32\u67d3\u8868\u73b0\u6bd4\u8f83\u590d\u6742\uff0c\u9700\u8981\u5bf9CSS3\u5bbd\u5ea6\u6709\u4e00\u5b9a\u4e86\u89e3\uff0c\u53ef\u4ee5\u9605\u8bfb\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=5392\">\u7406\u89e3CSS3 max\/min-content\u53cafit-content\u7b49width\u503c<\/a>\u201d\u8fd9\u7bc7\u6587\u7ae0\u3002\u5177\u4f53\u8868\u73b0\u5982\u4e0b\uff08\u4ee5\u6c34\u5e73\u5e03\u5c40\u4e3e\u4f8b\uff09\uff1a<\/p>\n<ul>\n<li>flex\u5b50\u9879\u6700\u5c0f\u5185\u5bb9\u5bbd\u5ea6<code>min-content<\/code>\u4e4b\u548c\u5927\u4e8eflex\u5bb9\u5668\u5bbd\u5ea6\uff0c\u5219\u5185\u5bb9\u6ea2\u51fa\uff0c\u8868\u73b0\u548c<code>white-space:nowrap<\/code>\u7c7b\u4f3c\u3002<\/li>\n<li>\u5982\u679cflex\u5b50\u9879\u6700\u5c0f\u5185\u5bb9\u5bbd\u5ea6<code>min-content<\/code>\u4e4b\u548c\u5c0f\u4e8eflex\u5bb9\u5668\u5bbd\u5ea6\uff0c\u5219\uff1a\n<ul>\n<li>flex\u5b50\u9879\u9ed8\u8ba4\u7684<code>fit-content<\/code>\u5bbd\u5ea6\u4e4b\u548c\u5927\u4e8eflex\u5bb9\u5668\u5bbd\u5ea6\uff0c\u5219flex\u5b50\u9879\u5bbd\u5ea6\u6536\u7f29\uff0c\u6b63\u597d\u586b\u6ee1flex\u5bb9\u5668\uff0c\u5185\u5bb9\u4e0d\u6ea2\u51fa\u3002<\/li>\n<li>flex\u5b50\u9879\u9ed8\u8ba4\u7684<code>fit-content<\/code>\u5bbd\u5ea6\u4e4b\u548c\u5c0f\u4e8eflex\u5bb9\u5668\u5bbd\u5ea6\uff0c\u5219flex\u5b50\u9879\u4ee5<code>fit-content<\/code>\u5bbd\u5ea6\u6b63\u5e38\u663e\u793a\uff0c\u5185\u5bb9\u4e0d\u6ea2\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5728\u4e0b\u9762\u6848\u4f8b\u4e2d\uff0c\u793a\u610f\u7684\u56fe\u7247\u9ed8\u8ba4\u6709\u8bbe\u7f6e<code>max-width:100%<\/code>\uff0cflex\u5b50\u9879div\u6ca1\u6709\u8bbe\u7f6e\u5bbd\u5ea6\uff0c\u56e0\u6b64\uff0cflex\u5b50\u9879\u6700\u5c0f\u5bbd\u5ea6\u662f\u65e0\u9650\u5c0f\uff0c\u8868\u73b0\u4e3a\u56fe\u7247\u5bbd\u5ea6\u6536\u7f29\u663e\u793a\u3002\u5982\u679c\u6211\u4eec\u53d6\u6d88<code>max-width:100%<\/code>\u6837\u5f0f\uff0c\u5219\u6b64\u65f6flex\u5b50\u9879\u6700\u5c0f\u5bbd\u5ea6\u5c31\u662f\u56fe\u7247\u5bbd\u5ea6\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u56fe\u7247\u6ea2\u51fa\u5230\u4e86flex\u5bb9\u5668\u4e4b\u5916\u3002<\/p>\n<\/dd>\n<dt>wrap<\/dt>\n<dd>\u5bbd\u5ea6\u4e0d\u8db3\u6362\u884c\u663e\u793a\u3002<\/dd>\n<dt>wrap-reverse<\/dt>\n<dd>\u5bbd\u5ea6\u4e0d\u8db3\u6362\u884c\u663e\u793a\uff0c\u4f46\u662f\u662f\u4ece\u4e0b\u5f80\u4e0a\u5f00\u59cb\uff0c\u4e5f\u5c31\u662f\u539f\u672c\u6362\u884c\u5728\u4e0b\u9762\u7684\u5b50\u9879\u73b0\u5728\u8dd1\u5230\u4e0a\u9762\u3002<\/dd>\n<\/dl>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u70b9\u51fb\u4e0b\u9762\u5bf9\u5e94\u5355\u590d\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u5e03\u5c40\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><input type=\"checkbox\" id=\"flexWrapMw\" checked><label for=\"flexWrapMw\" class=\"ui-checkbox\"><\/label><label for=\"flexWrapMw\">img{max-width:100%;}<\/label><\/p>\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexWrap1\" name=\"flexWrap\" value=\"nowrap\" checked><label for=\"flexWrap1\" class=\"ui-radio\"><\/label><label for=\"flexWrap1\" class=\"mr20\">nowrap<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexWrap2\" name=\"flexWrap\" value=\"wrap\"><label for=\"flexWrap2\" class=\"ui-radio\"><\/label><label for=\"flexWrap2\" class=\"mr20\">wrap<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexWrap3\" name=\"flexWrap\" value=\"wrap-reverse\"><label for=\"flexWrap3\" class=\"ui-radio\"><\/label><label for=\"flexWrap3\">wrap-reverse<\/label><\/span><\/p>\n<div class=\"flex\" id=\"flexWrap\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<div data-index=\"4\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm4.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm4.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72474\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h4 id=\"flex-flow\">3. flex-flow<\/h4>\n<p><code>flex-flow<\/code>\u5c5e\u6027\u662f<code>flex-direction<\/code>\u548c<code>flex-wrap<\/code>\u7684\u7f29\u5199\uff0c\u8868\u793aflex\u5e03\u5c40\u7684flow\u6d41\u52a8\u7279\u6027\uff0c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>flex-flow: <\u2018flex-direction\u2019> || <\u2018flex-wrap\u2019><\/pre>\n<p>\u5f53\u591a\u5c5e\u6027\u540c\u65f6\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u7a7a\u683c\u5206\u9694\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5bb9\u5668\u5143\u7d20\u5982\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n<pre>.container {\r\n    display: flex;\r\n    flex-flow: row-reverse wrap-reverse;\r\n}<\/pre>\n<p>\u5b9e\u65f6\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<div class=\"flex\" id=\"flexRow\" style=\"flex-flow: row-reverse wrap-reverse;\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\"><\/div>\n<div data-index=\"4\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm4.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm4.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72474\" width=\"128\" height=\"96\"><\/div>\n<\/div>\n<p>\u53ef\u4ee5\u770b\u5230\u6c34\u5e73\u6392\u5e8f\u4ece\u53f3\u5f80\u5de6\uff08<code>row-reverse<\/code>\u5c5e\u6027\u503c\u7684\u4f5c\u7528\uff09\uff0c\u4ee5\u53ca\u6362\u884c\u7684\u90a3\u4e00\u884c\u5728\u4e0a\u9762\uff08<code>wrap-reverse<\/code>\u5c5e\u6027\u503c\u7684\u4f5c\u7528\uff09\u3002<\/p>\n<h4 id=\"justify-content\">4. justify-content<\/h4>\n<p><code>justify-content<\/code>\u5c5e\u6027\u51b3\u5b9a\u4e86\u6c34\u5e73\u65b9\u5411\u5b50\u9879\u7684\u5bf9\u9f50\u548c\u5206\u5e03\u65b9\u5f0f\u3002CSS <code>text-align<\/code>\u6709\u4e2a\u5c5e\u6027\u503c\u4e3a<code>justify<\/code>\uff0c\u53ef\u5b9e\u73b0<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2015\/08\/chinese-english-same-padding-text-justify\/\">\u4e24\u7aef\u5bf9\u9f50<\/a>\uff0c\u6240\u4ee5\uff0c\u5f53\u6211\u4eec\u60f3\u8981\u63a7\u5236flex\u5143\u7d20\u7684\u6c34\u5e73\u5bf9\u9f50\u65b9\u5f0f\u7684\u65f6\u5019\uff0c\u8bb0\u4f4f<code>justify<\/code>\u8fd9\u4e2a\u5355\u8bcd\uff0c<code>justify-content<\/code>\u5c5e\u6027\u4e5f\u5c31\u8bb0\u4f4f\u4e86\u3002<\/p>\n<p><code>justify-content<\/code>\u53ef\u4ee5\u770b\u6210\u662f<code>text-align<\/code>\u7684\u8fdc\u623f\u4eb2\u621a\uff0c\u4e0d\u8fc7\u524d\u8005\u63a7\u5236flex\u5143\u7d20\u7684\u6c34\u5e73\u5bf9\u9f50\u5916\u52a0\u5206\u5e03\uff0c\u540e\u8005\u63a7\u5236\u5185\u8054\u5143\u7d20\u7684\u6c34\u5e73\u5bf9\u9f50\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly;<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl class=\"flex-dl\">\n<dt>flex-start<\/dt>\n<dd>\u9ed8\u8ba4\u503c\u3002\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u5de6\u5bf9\u9f50\u3002<\/dd>\n<dt>flex-end<\/dt>\n<dd>\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u53f3\u5bf9\u9f50\u3002<\/dd>\n<dt>center<\/dt>\n<dd>\u8868\u73b0\u4e3a\u5c45\u4e2d\u5bf9\u9f50\u3002<\/dd>\n<dt>space-between<\/dt>\n<dd>\u8868\u73b0\u4e3a\u4e24\u7aef\u5bf9\u9f50\u3002between\u662f\u4e2d\u95f4\u7684\u610f\u601d\uff0c\u610f\u601d\u662f\u591a\u4f59\u7684\u7a7a\u767d\u95f4\u8ddd\u53ea\u5728\u5143\u7d20\u4e2d\u95f4\u533a\u57df\u5206\u914d\u3002\u4f7f\u7528\u62bd\u8c61\u56fe\u5f62\u793a\u610f\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201810\/space-between.svg\" width=\"320\" height=\"72\" alt=\"space-between\u5206\u5e03\u6548\u679c\u793a\u610f\"><\/p>\n<\/dd>\n<dt>space-around<\/dt>\n<dd>around\u662f\u73af\u7ed5\u7684\u610f\u601d\uff0c\u610f\u601d\u662f\u6bcf\u4e2aflex\u5b50\u9879\u4e24\u4fa7\u90fd\u73af\u7ed5\u4e92\u4e0d\u5e72\u6270\u7684\u7b49\u5bbd\u7684\u7a7a\u767d\u95f4\u8ddd\uff0c\u6700\u7ec8\u89c6\u89c9\u4e0a\u8fb9\u7f18\u4e24\u4fa7\u7684\u7a7a\u767d\u53ea\u6709\u4e2d\u95f4\u7a7a\u767d\u5bbd\u5ea6\u4e00\u534a\u3002\u4f7f\u7528\u62bd\u8c61\u56fe\u5f62\u793a\u610f\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201810\/space-around.svg\" width=\"320\" height=\"65\" alt=\"space-around\u5206\u5e03\u6548\u679c\u793a\u610f\"><\/p>\n<\/dd>\n<dt>space-evenly<\/dt>\n<dd>evenly\u662f\u5300\u79f0\u3001\u5e73\u7b49\u7684\u610f\u601d\u3002\u4e5f\u5c31\u662f\u89c6\u89c9\u4e0a\uff0c\u6bcf\u4e2aflex\u5b50\u9879\u4e24\u4fa7\u7a7a\u767d\u95f4\u8ddd\u5b8c\u5168\u76f8\u7b49\u3002\u4f7f\u7528\u62bd\u8c61\u56fe\u5f62\u793a\u610f\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/201810\/space-evenly.svg\" width=\"320\" height=\"65\" alt=\"space-evenly\u5206\u5e03\u6548\u679c\u793a\u610f\"><\/p>\n<\/dd>\n<\/dl>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u70b9\u51fb\u4e0b\u9762\u5bf9\u5e94\u5355\u590d\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u5e03\u5c40\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><input type=\"checkbox\" id=\"dirRtl\"><label for=\"dirRtl\" class=\"ui-checkbox\"><\/label><label for=\"dirRtl\">direction:rtl\uff08\u6d4b\u8bd5flex-start\/flex-end\uff09<\/label><\/p>\n<p><span class=\"check-group\"><input type=\"radio\" id=\"justifyContent1\" name=\"justifyContent\" value=\"flex-start\" checked><label for=\"justifyContent1\" class=\"ui-radio\"><\/label><label for=\"justifyContent1\" class=\"mr20\">flex-start<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"justifyContent2\" name=\"justifyContent\" value=\"flex-end\"><label for=\"justifyContent2\" class=\"ui-radio\"><\/label><label for=\"justifyContent2\" class=\"mr20\">flex-end<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"justifyContent3\" name=\"justifyContent\" value=\"center\"><label for=\"justifyContent3\" class=\"ui-radio\"><\/label><label for=\"justifyContent3\" class=\"mr20\">center<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"justifyContent4\" name=\"justifyContent\" value=\"space-between\"><label for=\"justifyContent4\" class=\"ui-radio\"><\/label><label for=\"justifyContent4\" class=\"mr20\">space-between<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"justifyContent5\" name=\"justifyContent\" value=\"space-around\"><label for=\"justifyContent5\" class=\"ui-radio\"><\/label><label for=\"justifyContent5\" class=\"mr20\">space-around<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"justifyContent6\" name=\"justifyContent\" value=\"space-evenly\"><label for=\"justifyContent6\" class=\"ui-radio\"><\/label><label for=\"justifyContent6\">space-evenly<\/label><\/span><\/p>\n<div class=\"flex\" id=\"justifyContent\" style=\"flex-wrap: wrap;\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h4 id=\"align-items\">5. align-items<\/h4>\n<p><code>align-items<\/code>\u4e2d\u7684<code>items<\/code>\u6307\u7684\u5c31\u662fflex\u5b50\u9879\u4eec\uff0c\u56e0\u6b64<code>align-items<\/code>\u6307\u7684\u5c31\u662fflex\u5b50\u9879\u4eec\u76f8\u5bf9\u4e8eflex\u5bb9\u5668\u5728\u5782\u76f4\u65b9\u5411\u4e0a\u7684\u5bf9\u9f50\u65b9\u5f0f\uff0c\u5927\u5bb6\u662f\u4e00\u8d77\u9876\u90e8\u5bf9\u9f50\u5462\uff0c\u5e95\u90e8\u5bf9\u9f50\u5462\uff0c\u8fd8\u662f\u62c9\u4f38\u5bf9\u9f50\u5462\uff0c\u7c7b\u4f3c\u8fd9\u6837\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>align-items: stretch | flex-start | flex-end | center | baseline;<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl class=\"flex-dl\">\n<dt>stretch<\/dt>\n<dd>\u9ed8\u8ba4\u503c\u3002flex\u5b50\u9879\u62c9\u4f38\u3002\u5728\u6f14\u793a\u4e2d\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u767d\u84dd\u5f84\u5411\u6e10\u53d8\u80cc\u666f\u533a\u57df\u662f\u4e0a\u4e0b\u8d2f\u7a7fflex\u5bb9\u5668\u7684\uff0c\u5c31\u662f\u56e0\u4e3aflex\u5b50\u9879\u7684\u9ad8\u5ea6\u62c9\u4f38\u5230\u5bb9\u5668\u9ad8\u5ea6\u5bfc\u81f4\u3002\u5982\u679cflex\u5b50\u9879\u8bbe\u7f6e\u4e86\u9ad8\u5ea6\uff0c\u5219\u6309\u7167\u8bbe\u7f6e\u7684\u9ad8\u5ea6\u503c\u6e32\u67d3\uff0c\u800c\u975e\u62c9\u4f38\u3002<\/dd>\n<dt>flex-start<\/dt>\n<dd>\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u5bb9\u5668\u9876\u90e8\u5bf9\u9f50\u3002<\/dd>\n<dt>flex-end<\/dt>\n<dd>\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u5bb9\u5668\u5e95\u90e8\u5bf9\u9f50\u3002<\/dd>\n<dt>center<\/dt>\n<dd>\u8868\u73b0\u4e3a\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50\u3002<\/dd>\n<dt>baseline<\/dt>\n<dd>\u8868\u73b0\u4e3a\u6240\u6709flex\u5b50\u9879\u90fd\u76f8\u5bf9\u4e8eflex\u5bb9\u5668\u7684\u57fa\u7ebf\uff08<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2015\/06\/about-letter-x-of-css\/\">\u5b57\u6bcdx\u7684\u4e0b\u8fb9\u7f18<\/a>\uff09\u5bf9\u9f50\u3002<\/dd>\n<\/dl>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u70b9\u51fb\u4e0b\u9762\u5bf9\u5e94\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u5e03\u5c40\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"alignItems5\" name=\"alignItems\" value=\"stretch\" checked><label for=\"alignItems5\" class=\"ui-radio\"><\/label><label for=\"alignItems5\" class=\"mr20\">stretch<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignItems1\" name=\"alignItems\" value=\"flex-start\"><label for=\"alignItems1\" class=\"ui-radio\"><\/label><label for=\"alignItems1\" class=\"mr20\">flex-start<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignItems2\" name=\"alignItems\" value=\"flex-end\"><label for=\"alignItems2\" class=\"ui-radio\"><\/label><label for=\"alignItems2\" class=\"mr20\">flex-end<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignItems3\" name=\"alignItems\" value=\"center\"><label for=\"alignItems3\" class=\"ui-radio\"><\/label><label for=\"alignItems3\" class=\"mr20\">center<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignItems4\" name=\"alignItems\" value=\"baseline\"><label for=\"alignItems4\" class=\"ui-radio\"><\/label><label for=\"alignItems4\">baseline<\/label><\/span><\/p>\n<div class=\"flex\" id=\"alignItems\" style=\"flex-wrap: wrap;\">\n\tx<\/p>\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h4 id=\"align-content\">6. align-content<\/h4>\n<p><code>align-content<\/code>\u53ef\u4ee5\u770b\u6210\u548c<code>justify-content<\/code>\u662f\u76f8\u4f3c\u4e14\u5bf9\u7acb\u7684\u5c5e\u6027\uff0c<code>justify-content<\/code>\u6307\u660e\u6c34\u5e73\u65b9\u5411flex\u5b50\u9879\u7684\u5bf9\u9f50\u548c\u5206\u5e03\u65b9\u5f0f\uff0c\u800c<code>align-content<\/code>\u5219\u662f\u6307\u660e\u5782\u76f4\u65b9\u5411\u6bcf\u4e00\u884cflex\u5143\u7d20\u7684\u5bf9\u9f50\u548c\u5206\u5e03\u65b9\u5f0f\u3002\u5982\u679c\u6240\u6709flex\u5b50\u9879\u53ea\u6709\u4e00\u884c\uff0c\u5219<code>align-content<\/code>\u5c5e\u6027\u662f\u6ca1\u6709\u4efb\u4f55\u6548\u679c\u7684\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>align-content: stretch | flex-start | flex-end | center | space-between | space-around | space-evenly;<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl class=\"flex-dl\">\n<dt>stretch<\/dt>\n<dd>\u9ed8\u8ba4\u503c\u3002\u6bcf\u4e00\u884cflex\u5b50\u5143\u7d20\u90fd\u7b49\u6bd4\u4f8b\u62c9\u4f38\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5171\u4e24\u884cflex\u5b50\u5143\u7d20\uff0c\u5219\u6bcf\u4e00\u884c\u62c9\u4f38\u9ad8\u5ea6\u662f50%\u3002<\/dd>\n<dt>flex-start<\/dt>\n<dd>\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u9876\u90e8\u5806\u780c\u3002<\/dd>\n<dt>flex-end<\/dt>\n<dd>\u903b\u8f91CSS\u5c5e\u6027\u503c\uff0c\u4e0e\u6587\u6863\u6d41\u65b9\u5411\u76f8\u5173\u3002\u9ed8\u8ba4\u8868\u73b0\u4e3a\u5e95\u90e8\u5806\u653e\u3002<\/dd>\n<dt>center<\/dt>\n<dd>\u8868\u73b0\u4e3a\u6574\u4f53\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50\u3002<\/dd>\n<dt>space-between<\/dt>\n<dd>\u8868\u73b0\u4e3a\u4e0a\u4e0b\u4e24\u884c\u4e24\u7aef\u5bf9\u9f50\u3002\u5269\u4e0b\u6bcf\u4e00\u884c\u5143\u7d20\u7b49\u5206\u5269\u4f59\u7a7a\u95f4\u3002<\/dd>\n<dt>space-around<\/dt>\n<dd>\u6bcf\u4e00\u884c\u5143\u7d20\u4e0a\u4e0b\u90fd\u4eab\u6709\u72ec\u7acb\u4e0d\u91cd\u53e0\u7684\u7a7a\u767d\u7a7a\u95f4\u3002<\/dd>\n<dt>space-evenly<\/dt>\n<dd>\u6bcf\u4e00\u884c\u5143\u7d20\u90fd\u5b8c\u5168\u4e0a\u4e0b\u7b49\u5206\u3002<\/dd>\n<\/dl>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u6211\u4eec\u7ed9flex\u5bb9\u5668\u8bbe\u7f6e\u9ad8\u5ea6500\u50cf\u7d20\uff0c\u7136\u540e\u70b9\u51fb\u4e0b\u9762\u5bf9\u5e94\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u5e03\u5c40\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"alignContent5\" name=\"alignContent\" value=\"stretch\" checked><label for=\"alignContent5\" class=\"ui-radio\"><\/label><label for=\"alignContent5\" class=\"mr20\">stretch<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent1\" name=\"alignContent\" value=\"flex-start\"><label for=\"alignContent1\" class=\"ui-radio\"><\/label><label for=\"alignContent1\" class=\"mr20\">flex-start<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent2\" name=\"alignContent\" value=\"flex-end\"><label for=\"alignContent2\" class=\"ui-radio\"><\/label><label for=\"alignContent2\" class=\"mr20\">flex-end<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent3\" name=\"alignContent\" value=\"center\"><label for=\"alignContent3\" class=\"ui-radio\"><\/label><label for=\"alignContent3\" class=\"mr20\">center<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent4\" name=\"alignContent\" value=\"space-between\"><label for=\"alignContent4\" class=\"ui-radio\"><\/label><label for=\"alignContent4\" class=\"mr20\">space-between<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent6\" name=\"alignContent\" value=\"space-around\"><label for=\"alignContent6\" class=\"ui-radio\"><\/label><label for=\"alignContent6\" class=\"mr20\">space-around<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignContent7\" name=\"alignContent\" value=\"space-evenly\"><label for=\"alignContent7\" class=\"ui-radio\"><\/label><label for=\"alignContent7\">space-evenly<\/label><\/span><\/p>\n<div class=\"flex\" id=\"alignContent\" style=\"flex-wrap: wrap; height: 500px;\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<div data-index=\"4\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm4.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm4.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72474\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<div data-index=\"5\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm5.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm5.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72475\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"6\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm6.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm6.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72476\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<div data-index=\"7\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm7.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm7.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72477\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h3>\u4e09\u3001\u4f5c\u7528\u5728flex\u5b50\u9879\u4e0a\u7684CSS\u5c5e\u6027<\/h3>\n<h4 id=\"flex-order\">1. order<\/h4>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code>order<\/code>\u6539\u53d8\u67d0\u4e00\u4e2aflex\u5b50\u9879\u7684\u6392\u5e8f\u4f4d\u7f6e\u3002<\/p>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>order: &lt;integer&gt;; <span style=\"color: green;\">\/* \u6574\u6570\u503c\uff0c\u9ed8\u8ba4\u503c\u662f 0 *\/<\/span><\/pre>\n<p>\u6240\u6709flex\u5b50\u9879\u7684\u9ed8\u8ba4<code>order<\/code>\u5c5e\u6027\u503c\u662f0\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u67d0\u4e00\u4e2aflex\u5b50\u9879\u5728\u6700\u524d\u9762\u663e\u793a\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u6bd40\u5c0f\u7684\u6574\u6570\uff0c\u5982<code>-1<\/code>\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u4e0b\u9762flex\u5bb9\u5668\u67093\u4e2a\u5b50\u5143\u7d20\uff0c\u73b0\u5728\uff0c\u6211\u4eec\u7ed9\u7b2c2\u4e2a\u5b50\u5143\u7d20\u8bbe\u7f6e<code>order<\/code>\u5c5e\u6027\u503c\uff0c\u770b\u770b\u5176\u6392\u5217\u4f4d\u7f6e\u6709\u4f55\u53d8\u5316\u3002\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u4ea4\u4e92\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"order1\" name=\"order\" value=\"-1\"><label for=\"order1\" class=\"ui-radio\"><\/label><label for=\"order1\" class=\"mr20\">order:-1<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"order2\" name=\"order\" value=\"0\" checked><label for=\"order2\" class=\"ui-radio\"><\/label><label for=\"order2\" class=\"mr20\">order:0<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"order3\" name=\"order\" value=\"1\"><label for=\"order3\" class=\"ui-radio\"><\/label><label for=\"order3\">order:1<\/label><\/span><\/p>\n<div class=\"flex\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div id=\"order\" data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h4 id=\"flex-grow\">2. flex-grow<\/h4>\n<p><code>flex-grow<\/code>\u5c5e\u6027\u4e2d\u7684grow\u662f\u6269\u5c55\u7684\u610f\u601d\uff0c\u6269\u5c55\u7684\u5c31\u662fflex\u5b50\u9879\u6240\u5360\u636e\u7684\u5bbd\u5ea6\uff0c\u6269\u5c55\u6240\u4fb5\u5360\u7684\u7a7a\u95f4\u5c31\u662f\u9664\u53bb\u5143\u7d20\u5916\u7684\u5269\u4f59\u7684\u7a7a\u767d\u95f4\u9699\u3002<\/p>\n<p>\u5177\u4f53\u7684\u6269\u5c55\u6bd4\u8f83\u590d\u6742\u3002\u5728\u5c55\u5f00\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u770b\u4e0b\u8bed\u6cd5\u3002<\/p>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>flex-grow: &lt;number&gt;; <span style=\"color: green;\">\/* \u6570\u503c\uff0c\u53ef\u4ee5\u662f\u5c0f\u6570\uff0c\u9ed8\u8ba4\u503c\u662f 0 *\/<\/span><\/pre>\n<p><code>flex-grow<\/code>\u4e0d\u652f\u6301\u8d1f\u503c\uff0c\u9ed8\u8ba4\u503c\u662f0\uff0c\u8868\u793a\u4e0d\u5360\u7528\u5269\u4f59\u7684\u7a7a\u767d\u95f4\u9699\u6269\u5c55\u81ea\u5df1\u7684\u5bbd\u5ea6\u3002\u5982\u679c<code>flex-grow<\/code>\u5927\u4e8e0\uff0c\u5219flex\u5bb9\u5668\u5269\u4f59\u7a7a\u95f4\u7684\u5206\u914d\u5c31\u4f1a\u53d1\u751f\uff0c\u5177\u4f53\u89c4\u5219\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u6240\u6709\u5269\u4f59\u7a7a\u95f4\u603b\u91cf\u662f1\u3002<\/li>\n<li>\u5982\u679c\u53ea\u6709\u4e00\u4e2aflex\u5b50\u9879\u8bbe\u7f6e\u4e86<code>flex-grow<\/code>\u5c5e\u6027\u503c\uff1a\n<ul>\n<li>\u5982\u679c<code>flex-grow<\/code>\u503c\u5c0f\u4e8e1\uff0c\u5219\u6269\u5c55\u7684\u7a7a\u95f4\u5c31\u603b\u5269\u4f59\u7a7a\u95f4\u548c\u8fd9\u4e2a\u6bd4\u4f8b\u7684\u8ba1\u7b97\u503c\u3002<\/li>\n<li>\u5982\u679c<code>flex-grow<\/code>\u503c\u5927\u4e8e1\uff0c\u5219\u72ec\u4eab\u6240\u6709\u5269\u4f59\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n<p>\u5177\u4f53\u53ef\u53c2\u89c1\u4e0b\u9762\u201cgrow\u6848\u4f8b1\u201d\u3002<\/p>\n<\/li>\n<li>\n\t\t\u5982\u679c\u6709\u591a\u4e2aflex\u8bbe\u7f6e\u4e86<code>flex-grow<\/code>\u5c5e\u6027\u503c\uff1a<\/p>\n<ul>\n<li>\u5982\u679c<code>flex-grow<\/code>\u503c\u603b\u548c\u5c0f\u4e8e1\uff0c\u5219\u6bcf\u4e2a\u5b50\u9879\u6269\u5c55\u7684\u7a7a\u95f4\u5c31\u603b\u5269\u4f59\u7a7a\u95f4\u548c\u5f53\u524d\u5143\u7d20\u8bbe\u7f6e\u7684<code>flex-grow<\/code>\u6bd4\u4f8b\u7684\u8ba1\u7b97\u503c\u3002<\/li>\n<li>\u5982\u679c<code>flex-grow<\/code>\u503c\u603b\u548c\u5927\u4e8e1\uff0c\u5219\u6240\u6709\u5269\u4f59\u7a7a\u95f4\u88ab\u5229\u7528\uff0c\u5206\u914d\u6bd4\u4f8b\u5c31\u662f<code>flex-grow<\/code>\u5c5e\u6027\u503c\u7684\u6bd4\u4f8b\u3002\u4f8b\u5982\u6240\u6709\u7684flex\u5b50\u9879\u90fd\u8bbe\u7f6e<code>flex-grow:1<\/code>\uff0c\u5219\u8868\u793a\u5269\u4f59\u7a7a\u767d\u95f4\u9699\u5927\u5bb6\u7b49\u5206\uff0c\u5982\u679c\u8bbe\u7f6e\u7684<code>flex-grow<\/code>\u6bd4\u4f8b\u662f1:2:1\uff0c\u5219\u4e2d\u95f4\u7684flex\u5b50\u9879\u5360\u636e\u4e00\u534a\u7684\u7a7a\u767d\u95f4\u9699\uff0c\u5269\u4e0b\u7684\u524d\u540e\u4e24\u4e2a\u5143\u7d20\u7b49\u5206\u3002<\/li>\n<\/ul>\n<p>\u5177\u4f53\u53ef\u53c2\u89c1\u4e0b\u9762\u201cgrow\u6848\u4f8b2\u201d\u3002<\/p>\n<\/li>\n<\/ul>\n<p><strong>grow\u6848\u4f8b1\uff1a<\/strong><br \/>flex\u5bb9\u5668\u67093\u4e2a\u5b50\u5143\u7d20\uff0c\u73b0\u5728\uff0c\u6211\u4eec\u4ec5\u7ed9\u7b2c2\u4e2a\u5b50\u5143\u7d20\u8bbe\u7f6e<code>flex-grow<\/code>\u5c5e\u6027\u503c\uff0c\u770b\u770b\u5176\u5360\u636e\u5c3a\u5bf8\u6709\u4f55\u53d8\u5316\u3002\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u4ea4\u4e92\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexGrow0\" name=\"flexGrow\" value=\"0\" checked><label for=\"flexGrow0\" class=\"ui-radio\"><\/label><label for=\"flexGrow0\" class=\"mr20\">flex-grow:0<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow1\" name=\"flexGrow\" value=\"0.5\"><label for=\"flexGrow1\" class=\"ui-radio\"><\/label><label for=\"flexGrow1\" class=\"mr20\">flex-grow:0.5<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow2\" name=\"flexGrow\" value=\"1\"><label for=\"flexGrow2\" class=\"ui-radio\"><\/label><label for=\"flexGrow2\" class=\"mr20\">flex-grow:1<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow3\" name=\"flexGrow\" value=\"2\"><label for=\"flexGrow3\" class=\"ui-radio\"><\/label><label for=\"flexGrow3\">flex-grow:2<\/label><\/span><\/p>\n<div class=\"flex\" align=\"center\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div id=\"flexGrow\" data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<p>\u6b64\u5b9e\u4f8b\u6f14\u793a\u4e2d\uff0c\u4ec5\u4e00\u4e2aflex\u5b50\u9879\u8bbe\u7f6e\u4e86<code>flex-grow<\/code>\u5c5e\u6027\u503c\uff0c\u5f53\u6211\u4eec\u9009\u62e9<code>0.5<\/code>\u7684\u65f6\u5019\uff0c\u503c\u5c0f\u4e8e1\uff0c\u5269\u4f59\u7a7a\u95f4\u7528\u4e0d\u5b8c\uff0c\u56e0\u6b64\uff0c\u6269\u5c55\u7684\u5bbd\u5ea6\u662f\u603b\u5269\u4f59\u5bbd\u5ea6\u662f0.5\uff0c\u4e5f\u5c31\u662f\u4e00\u534a\uff1b\u5f53\u6211\u4eec\u9009\u62e9<code>1<\/code>\u7684\u65f6\u5019\uff0c\u6b63\u597d\u6240\u6709\u7a7a\u95f4\u90fd\u4f7f\u7528\uff1b\u5f53\u6211\u4eec\u9009\u62e9<code>2<\/code>\u7684\u65f6\u5019\uff0c\u6548\u679c\u4e00\u6837\uff0c\u56e0\u4e3a\u6ca1\u6709\u5176\u4ed6\u53c2\u4e0e\u5206\u914d\u7684\u5b50\u9879\uff0c\u56e0\u6b64\u6e32\u67d3\u8868\u73b0\u548c<code>1<\/code>\u4e00\u6837\u3002<\/p>\n<p><strong>grow\u6848\u4f8b2\uff1a<\/strong><br \/>flex\u5bb9\u5668\u67093\u4e2a\u5b50\u5143\u7d20\uff0c\u9ed8\u8ba4\u6240\u6709\u5b50\u9879\u90fd\u8bbe\u7f6e\u4e86<code>flex-grow:0.25<\/code>\uff0c\u73b0\u5728\u6211\u4eec\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u6539\u53d8\u7b2c2\u4e2a\u5b50\u5143\u7d20\u7684<code>flex-grow<\/code>\u5c5e\u6027\u503c\uff0c\u770b\u770b\u5176\u5360\u636e\u5c3a\u5bf8\u6709\u4f55\u53d8\u5316\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexGrow4\" name=\"flexGrow_2\" value=\"0\"><label for=\"flexGrow4\" class=\"ui-radio\"><\/label><label for=\"flexGrow4\" class=\"mr20\">flex-grow:0<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow5\" name=\"flexGrow_2\" value=\"0.25\" checked><label for=\"flexGrow5\" class=\"ui-radio\"><\/label><label for=\"flexGrow5\" class=\"mr20\">flex-grow:0.25<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow6\" name=\"flexGrow_2\" value=\"0.5\"><label for=\"flexGrow6\" class=\"ui-radio\"><\/label><label for=\"flexGrow6\" class=\"mr20\">flex-grow:0.5<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexGrow7\" name=\"flexGrow_2\" value=\"1\"><label for=\"flexGrow7\" class=\"ui-radio\"><\/label><label for=\"flexGrow7\">flex-grow:1<\/label><\/span><\/p>\n<div class=\"flex flex-grow\" align=\"center\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div id=\"flexGrow_2\" data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<p>\u6b64\u5b9e\u4f8b\u6f14\u793a\u4e2d\uff0c\u56e0\u4e3a3\u4e2a\u5b50\u9879\u90fd\u662f0.25\uff0c\u56e0\u6b64\u9ed8\u8ba4\u8fd8\u5269\u4f5925%\u7684\u5269\u4f59\u7a7a\u95f4\uff1b\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-grow:0<\/code>\uff0c\u5219\u52a0\u8d77\u6765\u7684<code>flex-grow<\/code>\u662f<code>0.5<\/code>\uff0c\u56e0\u6b64\u5269\u4f5950%\u7a7a\u95f4\uff1b\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-grow:0.5<\/code>\uff0c\u5219\u52a0\u8d77\u6765\u7684<code>flex-grow<\/code>\u662f<code>1<\/code>\uff0c\u56e0\u6b64\u6ca1\u6709\u5269\u4f59\u7a7a\u95f4\uff0c\u540c\u65f6\u7a7a\u95f4\u5360\u7528\u6bd4\u4f8b\u4e3a1:2:1\uff0c\u6700\u7ec8\u6548\u679c\u7b26\u5408\u6b64\u9884\u671f\uff1b\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-grow:1<\/code>\uff0c\u5219\u52a0\u8d77\u6765\u7684<code>flex-grow<\/code>\u5927\u4e8e<code>1<\/code>\uff0c\u5269\u4f59\u7a7a\u95f4\u6309\u6bd4\u4f8b\u5206\u914d\uff0c\u4e3a1:4:1\uff0c\u6700\u7ec8\u6548\u679c\u4e5f\u786e\u5b9e\u5982\u6b64\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f<code>flex-grow<\/code>\u5c5e\u6027\u7684\u4f5c\u7528\u89c4\u5219\u3002<\/p>\n<h4 id=\"flex-shrink\">3. flex-shrink<\/h4>\n<p>shrink\u662f\u201c\u6536\u7f29\u201d\u7684\u610f\u601d\uff0c<code>flex-shrink<\/code>\u4e3b\u8981\u5904\u7406\u5f53flex\u5bb9\u5668\u7a7a\u95f4\u4e0d\u8db3\u65f6\u5019\uff0c\u5355\u4e2a\u5143\u7d20\u7684\u6536\u7f29\u6bd4\u4f8b\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>flex-shrink: &lt;number&gt;; <span style=\"color:green;\">\/* \u6570\u503c\uff0c\u9ed8\u8ba4\u503c\u662f 1 *\/<\/span><\/pre>\n<p><code>flex-shrink<\/code>\u4e0d\u652f\u6301\u8d1f\u503c\uff0c\u9ed8\u8ba4\u503c\u662f1\uff0c\u4e5f\u5c31\u662f\u9ed8\u8ba4\u6240\u6709\u7684flex\u5b50\u9879\u90fd\u4f1a\u6536\u7f29\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a0\uff0c\u5219\u8868\u793a\u4e0d\u6536\u7f29\uff0c\u4fdd\u6301\u539f\u59cb\u7684<code>fit-content<\/code>\u5bbd\u5ea6\u3002<\/p>\n<p><code>flex-shrink<\/code>\u7684\u5185\u6838\u8ddf<code>flex-grow<\/code>\u5f88\u795e\u4f3c\uff0c<code>flex-grow<\/code>\u662f\u7a7a\u95f4\u8db3\u591f\u65f6\u5019\u5982\u4f55\u5229\u7528\u7a7a\u95f4\uff0c<code>flex-shrink<\/code>\u5219\u662f\u7a7a\u95f4\u4e0d\u8db3\u65f6\u5019\u5982\u4f55\u6536\u7f29\u817e\u51fa\u7a7a\u95f4\u3002\u603b\u6709\u70b9CP\u7684\u5473\u9053\u3002<\/p>\n<p>\u4e24\u8005\u7684\u89c4\u5219\u4e5f\u662f\u7c7b\u4f3c\u3002\u5df2\u77e5flex\u5b50\u9879\u4e0d\u6362\u884c\uff0c\u4e14\u5bb9\u5668\u7a7a\u95f4\u4e0d\u8db3\uff0c\u4e0d\u8db3\u7684\u7a7a\u95f4\u5c31\u662f\u201c\u5b8c\u5168\u6536\u7f29\u7684\u5c3a\u5bf8\u201d\uff1a<\/p>\n<ul>\n<li>\u5982\u679c\u53ea\u6709\u4e00\u4e2aflex\u5b50\u9879\u8bbe\u7f6e\u4e86<code>flex-shrink<\/code>\uff1a\n<ul>\n<li><code>flex-shrink<\/code>\u503c\u5c0f\u4e8e1\uff0c\u5219\u6536\u7f29\u7684\u5c3a\u5bf8\u4e0d\u5b8c\u5168\uff0c\u4f1a\u6709\u4e00\u90e8\u5206\u5185\u5bb9\u6ea2\u51faflex\u5bb9\u5668\u3002<\/li>\n<li><code>flex-shrink<\/code>\u503c\u5927\u4e8e\u7b49\u4e8e1\uff0c\u5219\u6536\u7f29\u5b8c\u5168\uff0c\u6b63\u597d\u586b\u6ee1flex\u5bb9\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5982\u679c\u591a\u4e2aflex\u5b50\u9879\u8bbe\u7f6e\u4e86<code>flex-shrink<\/code>\uff1a\n<ul>\n<li><code>flex-shrink<\/code>\u503c\u7684\u603b\u548c\u5c0f\u4e8e1\uff0c\u5219\u6536\u7f29\u7684\u5c3a\u5bf8\u4e0d\u5b8c\u5168\uff0c\u6bcf\u4e2a\u5143\u7d20\u6536\u7f29\u5c3a\u5bf8\u5360\u201c\u5b8c\u5168\u6536\u7f29\u7684\u5c3a\u5bf8\u201d\u7684\u6bd4\u4f8b\u5c31\u662f\u8bbe\u7f6e\u7684<code>flex-shrink<\/code>\u7684\u503c\u3002<\/li>\n<li><code>flex-shrink<\/code>\u503c\u7684\u603b\u548c\u5927\u4e8e1\uff0c\u5219\u6536\u7f29\u5b8c\u5168\uff0c\u6bcf\u4e2a\u5143\u7d20\u6536\u7f29\u5c3a\u5bf8\u7684\u6bd4\u4f8b\u548c<code>flex-shrink<\/code>\u503c\u7684\u6bd4\u4f8b\u4e00\u6837\u3002\u4e0b\u9762\u6848\u4f8b\u6f14\u793a\u7684\u5c31\u662f\u6b64\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0cflex\u5bb9\u5668\u67094\u4e2a\u5b50\u5143\u7d20\uff0c\u73b0\u5728\uff0c\u6211\u4eec\u7ed9\u7b2c2\u4e2a\u5b50\u5143\u7d20\u8bbe\u7f6e\u4e0d\u540c\u7684<code>flex-shrink<\/code>\u5c5e\u6027\u503c\uff0c\u770b\u770b\u5176\u5360\u636e\u5c3a\u5bf8\u6709\u4f55\u53d8\u5316\u3002\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u4ea4\u4e92\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexShrink0\" name=\"flexShrink\" value=\"0\"><label for=\"flexShrink0\" class=\"ui-radio\"><\/label><label for=\"flexShrink0\" class=\"mr20\">flex-shrink:0<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexShrink1\" name=\"flexShrink\" value=\"0.5\"><label for=\"flexShrink1\" class=\"ui-radio\"><\/label><label for=\"flexShrink1\" class=\"mr20\">flex-shrink:0.5<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexShrink2\" name=\"flexShrink\" value=\"1\" checked><label for=\"flexShrink2\" class=\"ui-radio\"><\/label><label for=\"flexShrink2\" class=\"mr20\">flex-shrink:1<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexShrink3\" name=\"flexShrink\" value=\"2\"><label for=\"flexShrink3\" class=\"ui-radio\"><\/label><label for=\"flexShrink3\">flex-shrink:2<\/label><\/span><\/p>\n<div class=\"flex\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div id=\"flexShrink\" data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<div data-index=\"4\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm4.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm4.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72474\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<p>\u6b64\u5b9e\u4f8b\u6f14\u793a\u4e2d\uff0c\u56e0\u4e3a4\u4e2a\u5b50\u9879\u90fd\u662f1\uff0c\u548c\u8fdc\u5927\u4e8e1\uff0c\u56e0\u6b64\uff0c\u5b8c\u5168\u6536\u7f29\uff0c\u4e0d\u4f1a\u6709\u5185\u5bb9\u6ea2\u51fa\u3002\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-shrink:0<\/code>\uff0c\u5219\u7b2c2\u4e2aflex\u5b50\u9879\u4e0d\u6536\u7f29\uff0c\u5269\u4e0b3\u4e2aflex\u5b50\u9879\u7b49\u6bd4\u4f8b\u6536\u7f29\uff1b\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-shrink:1<\/code>\uff0c\u52194\u4e2a\u5b50\u98791:1:1:1\u6536\u7f29\uff1b\u5982\u679c\u6211\u4eec\u9009\u62e9<code>flex-shrink:2<\/code>\uff0c\u5219\u5b8c\u5168\u6536\u7f29\u5c3a\u5bf8\u6bd4\u4f8b\u5206\u914d\u4e3a1:2:1:1\uff0c\u7b2c2\u4e2aflex\u5b50\u9879\u6536\u7f29\u7684\u5bbd\u5ea6\u6700\u5927\uff0c\u662f\u5176\u4ed6\u5143\u7d20\u76842\u500d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f<code>flex-shrink<\/code>\u5c5e\u6027\u7684\u4f5c\u7528\u89c4\u5219\u3002<\/p>\n<h4 id=\"flex-basis\">4. flex-basis<\/h4>\n<p><code>flex-basis<\/code>\u5b9a\u4e49\u4e86\u5728\u5206\u914d\u5269\u4f59\u7a7a\u95f4\u4e4b\u524d\u5143\u7d20\u7684\u9ed8\u8ba4\u5927\u5c0f\u3002\u76f8\u5f53\u4e8e\u5bf9\u6d4f\u89c8\u5668\u63d0\u524d\u544a\u77e5\uff1a\u6d4f\u89c8\u5668\u5144\uff0c\u6211\u8981\u5360\u636e\u8fd9\u4e48\u5927\u7684\u7a7a\u95f4\uff0c\u63d0\u524d\u5e2e\u6211\u9884\u7559\u597d\u3002<\/p>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>flex-basis: &lt;length&gt; | auto; <span style=\"color:green;\">\/* \u9ed8\u8ba4\u503c\u662f auto *\/<\/span><\/pre>\n<p>\u9ed8\u8ba4\u503c\u662f<code>auto<\/code>\uff0c\u5c31\u662f\u81ea\u52a8\u3002\u6709\u8bbe\u7f6e<code>width<\/code>\u5219\u5360\u636e\u7a7a\u95f4\u5c31\u662f<code>width<\/code>\uff0c\u6ca1\u6709\u8bbe\u7f6e\u5c31\u6309\u5185\u5bb9\u5bbd\u5ea6\u6765\u3002<\/p>\n<p>\u5982\u679c\u540c\u65f6\u8bbe\u7f6e<code>width<\/code>\u548c<code>flex-basis<\/code>\uff0c\u5c31\u6e32\u67d3\u8868\u73b0\u6765\u770b\uff0c\u4f1a\u5ffd\u7565<code>width<\/code>\u3002flex\u987e\u540d\u601d\u4e49\u5c31\u662f\u5f39\u6027\u7684\u610f\u601d\uff0c\u56e0\u6b64\uff0c\u5b9e\u9645\u4e0a\u4e0d\u5efa\u8bae\u5bf9flex\u5b50\u9879\u4f7f\u7528<code>width<\/code>\u5c5e\u6027\uff0c\u56e0\u4e3a\u4e0d\u591f\u5f39\u6027\u3002<\/p>\n<p>\u5f53\u5269\u4f59\u7a7a\u95f4\u4e0d\u8db3\u7684\u65f6\u5019\uff0cflex\u5b50\u9879\u7684\u5b9e\u9645\u5bbd\u5ea6\u5e76\u901a\u5e38\u4e0d\u662f\u8bbe\u7f6e\u7684<code>flex-basis<\/code>\u5c3a\u5bf8\uff0c\u56e0\u4e3aflex\u5e03\u5c40\u5269\u4f59\u7a7a\u95f4\u4e0d\u8db3\u7684\u65f6\u5019\u9ed8\u8ba4\u4f1a\u6536\u7f29\u3002<\/p>\n<p><strong>\u5b9e\u4f8b\u4e00\u5219\uff1a<\/strong><br \/>flex\u5bb9\u5668\u67093\u4e2a\u5b50\u5143\u7d20\uff0c\u73b0\u5728\uff0c\u6211\u4eec\u7ed9\u7b2c2\u4e2a\u5b50\u5143\u7d20\u8bbe\u7f6e\u4e0d\u540c\u7684<code>flex-basis<\/code>\u5c5e\u6027\u503c\uff0c\u770b\u770b\u5176\u5360\u636e\u5c3a\u5bf8\u6709\u4f55\u53d8\u5316\u3002\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u53ef\u4ee5\u770b\u5230\u5b9e\u65f6\u7684\u4ea4\u4e92\u6548\u679c\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"flexBasis1\" name=\"flexBasis\" value=\"64px\"><label for=\"flexBasis1\" class=\"ui-radio\"><\/label><label for=\"flexBasis1\" class=\"mr20\">flex-basis:64px<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexBasis2\" name=\"flexBasis\" value=\"96px\" checked><label for=\"flexBasis2\" class=\"ui-radio\"><\/label><label for=\"flexBasis2\" class=\"mr20\">flex-basis:96px<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexBasis3\" name=\"flexBasis\" value=\"128px\"><label for=\"flexBasis3\" class=\"ui-radio\"><\/label><label for=\"flexBasis3\" class=\"mr20\">flex-basis:128px<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexBasis4\" name=\"flexBasis\" value=\"256px\"><label for=\"flexBasis4\" class=\"ui-radio\"><\/label><label for=\"flexBasis4\">flex-basis:256px<\/label><\/span><\/p>\n<div class=\"flex\" align=\"center\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div id=\"flexBasis\" data-index=\"2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<p>\u9009\u62e9\u6700\u540e\u4e00\u4e2a<code>flex-basis:256px<\/code>\u4f1a\u53d1\u73b0flex\u5b50\u9879\u7684\u5bbd\u5ea6\u5e76\u4e0d\u662f<code>256px<\/code>\uff0c\u8fd9\u662f\u56e0\u4e3a\u6b64\u65f6\u5269\u4f59\u7a7a\u95f4\u4e0d\u8db3\uff0c3\u4e2a\u5b50\u98791:1:1\u6536\u7f29\u7684\u7f18\u6545\u3002<\/p>\n<h4 id=\"flex-flex\">5. flex<\/h4>\n<p><code>flex<\/code>\u5c5e\u6027\u662f<code>flex-grow<\/code>\uff0c<code>flex-shrink<\/code>\u548c<code>flex-basis<\/code>\u7684\u7f29\u5199\u3002 <\/p>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>flex: none | auto | [ &lt;'flex-grow'&gt; &lt;'flex-shrink'&gt;? || &lt;'flex-basis'&gt; ]<\/pre>\n<p>\u5176\u4e2d\u7b2c2\u548c\u7b2c3\u4e2a\u53c2\u6570\uff08<code>flex-shrink<\/code>\u548c<code>flex-basis<\/code>\uff09\u662f\u53ef\u9009\u7684\u3002\u9ed8\u8ba4\u503c\u4e3a<code>0 1 auto<\/code>\u3002<\/p>\n<\/p>\n<p><strong>\u6848\u4f8b\u6f14\u793a\uff1a<\/strong><\/p>\n<p>\u7b2c2\u4e2aflex\u5b50\u9879\u8bbe\u7f6e<code>flex:none<\/code>\u6216\u8005<code>flex:auto<\/code>\uff0c\u6211\u4eec\u770b\u770b\u5b9e\u65f6\u5e03\u5c40\u6548\u679c\u4f1a\u6709\u600e\u6837\u7684\u53d8\u5316\uff1a<\/p>\n<div class=\"flex-test-x\">\n<p><input type=\"checkbox\" id=\"flexHidden\"><label for=\"flexHidden\" class=\"ui-checkbox\"><\/label><label for=\"flexHidden\">\u9690\u85cf\u90e8\u5206\u56fe\u7247\u4f7f\u7a7a\u95f4\u5269\u4f59\uff08\u4e3a\u4e86\u6d4bflex-grow\uff09<\/label><\/p>\n<p id=\"flexOutRadioX\"><span class=\"check-group\"><input type=\"radio\" id=\"flexDefault\" name=\"flex_2\" value=\"\" checked><label for=\"flexDefault\" class=\"ui-radio\"><\/label><label for=\"flexDefault\" class=\"mr20\">flex\u9ed8\u8ba4\u503c<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexNone\" name=\"flex_2\" value=\"none\"><label for=\"flexNone\" class=\"ui-radio\"><\/label><label for=\"flexNone\" class=\"mr20\">flex:none<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"flexAuto\" name=\"flex_2\" value=\"auto\"><label for=\"flexAuto\" class=\"ui-radio\"><\/label><label for=\"flexAuto\">flex:auto<\/label><\/span><\/p>\n<div id=\"flexImgX\" class=\"flex\">\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\"><\/div>\n<div data-index=\"2\" id=\"flex_2\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\"><\/div>\n<div data-index=\"4\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm4.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm4.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72474\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<p>\u6b64\u65f6\u7b2c2\u4e2aflex\u5b50\u9879\u7684<code>flex-grow<\/code>\uff0c<code>flex-shrink<\/code>\u548c<code>flex-basis<\/code>\u5c5e\u6027\u503c\u5206\u522b\u662f<code class=\"flexOutput\">0<\/code>\uff0c<code class=\"flexOutput\">1<\/code>\uff0c\u548c<code class=\"flexOutput\">auto<\/code>\u3002<\/p>\n<p>\u7ecf\u8fc7\u4e0a\u9762\u4e00\u756a\u6d4b\u8bd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u7ed3\u8bba\uff1a<\/p>\n<ul>\n<li><code>flex<\/code>\u9ed8\u8ba4\u503c\u7b49\u540c\u4e8e<code>flex:0 1 auto<\/code>\uff1b<\/li>\n<li><code>flex:none<\/code>\u7b49\u540c\u4e8e<code>flex:0 0 auto<\/code>\uff1b<\/li>\n<li><code>flex:auto<\/code>\u7b49\u540c\u4e8e<code>flex:1 1 auto<\/code>\uff1b<\/li>\n<\/ul>\n<h4 id=\"align-self\">6. align-self<\/h4>\n<p><code>align-self<\/code>\u6307\u63a7\u5236\u5355\u72ec\u67d0\u4e00\u4e2aflex\u5b50\u9879\u7684\u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f\uff0c\u5199\u5728flex\u5bb9\u5668\u4e0a\u7684\u8fd9\u4e2a<code>align-items<\/code>\u5c5e\u6027\uff0c\u540e\u9762\u662fitems\uff0c\u6709\u4e2as\uff0c\u8868\u793a\u5b50\u9879\u4eec\uff0c\u662f\u5168\u4f53\uff1b\u8fd9\u91cc\u662fself\uff0c\u5355\u72ec\u4e00\u4e2a\u4e2a\u4f53\u3002\u5176\u4ed6\u533a\u522b\u4e0d\u5927\uff0c\u8bed\u6cd5\u51e0\u4e4e\u4e00\u6837\uff1a<\/p>\n<pre>align-self: auto | flex-start | flex-end | center | baseline | stretch;<\/pre>\n<p>\u552f\u4e00\u533a\u522b\u5c31\u662f<code>align-self<\/code>\u591a\u4e86\u4e2a<code>auto<\/code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u8868\u793a\u7ee7\u627f\u81eaflex\u5bb9\u5668\u7684<code>align-items<\/code>\u5c5e\u6027\u503c\u3002\u5176\u4ed6\u5c5e\u6027\u503c\u542b\u4e49\u4e00\u6a21\u4e00\u6837\uff0c\u5982\u4e0b\u6848\u4f8b\u793a\u610f\uff1a<\/p>\n<p>\u9996\u5148\u6211\u4eec\u8bbe\u7f6eflex\u5bb9\u5668<code>baseline<\/code>\u5bf9\u9f50\uff0c\u7136\u540e\u70b9\u51fb\u4e0b\u9762\u7684\u5355\u9009\u6846\uff0c\u7ed9\u7b2c2\u4e2aflex\u5b50\u9879\u8bbe\u7f6e\u4e0d\u540c<code>align-self<\/code>\u5c5e\u6027\u503c\uff0c\u89c2\u5bdf\u5176\u8868\u73b0\uff1a<\/p>\n<pre>.container {\r\n    display: flex;\r\n    align-items: baseline;\r\n    height: 240px;\r\n}<\/pre>\n<div class=\"flex-test-x\">\n<p><span class=\"check-group\"><input type=\"radio\" id=\"alignSelf0\" name=\"alignSelf\" value=\"auto\" checked><label for=\"alignSelf0\" class=\"ui-radio\"><\/label><label for=\"alignSelf0\" class=\"mr20\">auto<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignSelf1\" name=\"alignSelf\" value=\"flex-start\"><label for=\"alignSelf1\" class=\"ui-radio\"><\/label><label for=\"alignSelf1\" class=\"mr20\">flex-start<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignSelf2\" name=\"alignSelf\" value=\"flex-end\"><label for=\"alignSelf2\" class=\"ui-radio\"><\/label><label for=\"alignSelf2\" class=\"mr20\">flex-end<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignSelf3\" name=\"alignSelf\" value=\"center\"><label for=\"alignSelf3\" class=\"ui-radio\"><\/label><label for=\"alignSelf3\" class=\"mr20\">center<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignSelf4\" name=\"alignSelf\" value=\"baseline\"><label for=\"alignSelf4\" class=\"ui-radio\"><\/label><label for=\"alignSelf4\" class=\"mr20\">baseline<\/label><\/span> <span class=\"check-group\"><input type=\"radio\" id=\"alignSelf5\" name=\"alignSelf\" value=\"stretch\"><label for=\"alignSelf5\" class=\"ui-radio\"><\/label><label for=\"alignSelf5\" class=\"mr20\">stretch<\/label><\/span><\/p>\n<div class=\"flex\" style=\"height: 240px;align-items: baseline;\">\n\tx<\/p>\n<div data-index=\"1\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72471\" width=\"128\" height=\"86\" class=\"size-small\" class=\"size-small\"><\/div>\n<div data-index=\"2\" id=\"alignSelf\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm2.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm2.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72472\" width=\"96\" height=\"128\" class=\"size-small\"><\/div>\n<div data-index=\"3\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s128\/mm3.jpg\" srcset=\"\/\/image.zhangxinxu.com\/image\/study\/s\/s256\/mm3.jpg 2x\" alt=\"\u793a\u610f\u56fe\u72473\" width=\"128\" height=\"96\" class=\"size-small\"><\/div>\n<\/div>\n<\/div>\n<h3>\u56db\u3001\u5176\u4ed6Flex\u77e5\u8bc6\u70b9<\/h3>\n<ul>\n<li>\u5728Flex\u5e03\u5c40\u4e2d\uff0cflex\u5b50\u5143\u7d20\u7684\u8bbe\u7f6e<code>float<\/code>\uff0c<code>clear<\/code>\u4ee5\u53ca<code>vertical-align<\/code>\u5c5e\u6027\u90fd\u662f\u6ca1\u6709\u7528\u7684\u3002<\/li>\n<li>Flexbox\u5e03\u5c40\u6700\u9002\u5408\u5e94\u7528\u7a0b\u5e8f\u7684\u7ec4\u4ef6\u548c\u5c0f\u89c4\u6a21\u5e03\u5c40\uff08\u4e00\u7ef4\u5e03\u5c40\uff09\uff0c\u800cGrid\u5e03\u5c40\u5219\u9002\u7528\u4e8e\u66f4\u5927\u89c4\u6a21\u7684\u5e03\u5c40\uff08\u4e8c\u7ef4\u5e03\u5c40\uff09\uff0c\u5173Grid\u5e03\u5c40\u8bf7\u53c2\u89c1\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=8144\">\u5199\u7ed9\u81ea\u5df1\u770b\u7684display: grid\u5e03\u5c40\u6559\u7a0b\u201d\u4e00\u6587<\/a>\u3002<\/li>\n<li>\u5df2\u7ecf8102\u5e74\u4e86\uff0cFlex\u8001\u8bed\u6cd5\u4e0d\u7528\u5728\u7ba1\u4e86\uff0c\u8212\u723d\u5f03\u4e4b\uff0c\u7136\u540e\u79c1\u6709\u524d\u7f00\u4e5f\u4e0d\u7528\u518d\u52a0\u4e86\uff0c\u770b\u5230\u5c31\u70e6\u3002<\/li>\n<\/ul>\n<p>\u672c\u6559\u7a0b\u4f18\u70b9\u5728\u4e8e\u4ea4\u4e92\u6548\u679c\u53ef\u4ee5\u5b9e\u65f6\u4f53\u9a8c\uff0c\u66f4\u76f4\u89c2\u3002\u5982\u679c\u662f\u8f6c\u8f7d\u6587\u7ae0\uff0c\u5fc5\u5b9a\u6ca1\u6709\u6548\u679c\uff0c\u8bbf\u95ee\u539f\u6587\u5373\u53ef\u3002<\/p>\n<p>\u8bf4\u5b9e\u8bdd\uff0c\u81ea\u5df1\u4e4b\u524dFlex\u5e03\u5c40\u7528\u5f97\u5f88\u5c11\uff0c\u672c\u6587\u5185\u5bb9\u81ea\u5df1\u4e5f\u662f\u8fb9\u5b66\u8fb9\u5199\uff0c\u6587\u4e2d\u82e5\u6709\u8868\u8ff0\u4e0d\u51c6\u786e\u7684\u5730\u65b9\u6b22\u8fce\u6307\u6b63\u3002<\/p>\n<p>\u611f\u8c22\u9605\u8bfb\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f603.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u53c2\u8003\u6587\u7ae0\uff1a<a href=\"https:\/\/css-tricks.com\/snippets\/css\/a-guide-to-flexbox\/\" rel=\"noopener nofollow\" target=\"_blank\">A Complete Guide to Flexbox<\/a><\/p>\n<p><script src=\"\/study\/201810\/flex.js\"><\/script><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=8063<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201810\/flex-thumb.jpg\" width=\"161\" height=\"100\" class=\"alignright size-medium\" alt=\"display:flex\u5e03\u5c40\" \/><\/p>\n<p>\u672c\u6587\u8be6\u5c3d\u4ecb\u7ecd\u4e86display:flex\u5e03\u5c40\u7684\u5404\u4e2a\u5c5e\u6027\uff0c\u6700\u5927\u7684\u4f18\u70b9\u5728\u4e8e\u6240\u6709flex\u76f8\u5173\u5c5e\u6027\u503c\u7684\u6837\u5f0f\u8868\u73b0\u90fd\u662f\u5b9e\u65f6\u6e32\u67d3\u7684\uff0c\u70b9\u51fb\u4e0d\u540c\u7684\u5c5e\u6027\u503c\uff0c\u5c31\u53ef\u4ee5\u7acb\u5373\u5b9e\u65f6\u770b\u5230\u4e0d\u540c\u7684\u5e03\u5c40\u6548\u679c\uff0c\u975e\u5e38\u76f4\u89c2\u3002\u540c\u65f6\uff0c\u5f88\u591a\u5c5e\u6027\u7684\u89c4\u5219\u63cf\u8ff0\u8981\u6bd4\u73b0\u6709\u7684\u5f88\u591a\u6587\u7ae0\u4ecb\u7ecd\u7684\u8981\u66f4\u8be6\u5c3d\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u4e00\u5b9a\u662f\u4e00\u4e2a\u5f88\u4e0d\u9519\u7684\u5b66\u4e60\u6559\u7a0b\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":[1341,1340,1346,536,177,1335,1345,1336,1338,1343,1344,1337,1339,1342,231],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/8063"}],"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=8063"}],"version-history":[{"count":1,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/8063\/revisions"}],"predecessor-version":[{"id":11659,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/8063\/revisions\/11659"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=8063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=8063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=8063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}