{"id":3338,"date":"2024-11-10T17:28:06","date_gmt":"2024-11-10T09:28:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3338\/"},"modified":"2024-11-10T17:28:06","modified_gmt":"2024-11-10T09:28:06","slug":"%e5%a6%82%e4%bd%95%e8%ae%a9%e5%85%84%e5%bc%9f%e5%85%83%e7%b4%a0%e7%ad%89%e5%ae%bd%ef%bc%8c%e8%b7%9f%e9%9a%8f%e6%9c%80%e9%95%bf%e5%85%83%e7%b4%a0%e7%9a%84%e5%ae%bd%e5%ba%a6%e5%8f%98%e5%8c%96%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3338\/","title":{"rendered":"\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u53d8\u5316\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173103131275994.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u53d8\u5316\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u53d8\u5316\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\uff1f<\/strong><\/p>\n<p>CSS \u4e2d\u5e38\u89c1\u7684\u8bbe\u8ba1\u9700\u6c42\u662f\u8ba9\u5144\u5f1f\u5143\u7d20\u81ea\u52a8\u5339\u914d\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u3002\u8fd9\u901a\u5e38\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u5de7\u5999\u7684\u6280\u5de7\u6765\u89e3\u51b3\u3002<\/p>\n<p>\u8981\u5b9e\u73b0\u6307\u5b9a\u9700\u6c42\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li> <strong>\u7236\u5bb9\u5668\u8bbe\u7f6e\u4e3a flexbox<\/strong>\uff1a\u5c06\u5144\u5f1f\u5143\u7d20\u7684\u7236\u5bb9\u5668\u8bbe\u7f6e\u6210 flexbox \u5e03\u5c40\uff0c\u5e76\u8bbe\u7f6e flex-direction \u4e3a row\u3002<\/li>\n<li> <strong>\u8bbe\u7f6e\u5bbd\u5ea6\u4e3a fit-content<\/strong>\uff1a\u7ed9\u7236\u5bb9\u5668\u8bbe\u7f6e width: fit-content\uff0c\u5b83\u4f1a\u81ea\u52a8\u8c03\u6574\u5bbd\u5ea6\u4ee5\u5bb9\u7eb3\u5b50\u5143\u7d20\u3002<\/li>\n<li> <strong>\u989d\u5916\u5305\u88c5\u4e00\u5c42<\/strong>\uff1a\u5728\u7236\u5bb9\u5668\u5916\u90e8\u518d\u5305\u4e00\u5c42 div\uff0c\u907f\u514d\u6eda\u52a8\u6761\u51fa\u73b0\u5728 body \u5143\u7d20\u4e0a\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\uff1a<\/p>\n<pre>&lt;div class=\"wrap\"&gt;\n  &lt;div class=\"container\"&gt;\n    &lt;div class=\"item1\"&gt;item1&lt;\/div&gt;\n    &lt;div class=\"item2\"&gt;item2&lt;\/div&gt;\n    &lt;div class=\"item3\"&gt;item3&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>.wrap {\n  width: 100%;\n  overflow-x: auto;\n}\n\n.container {\n  width: fit-content;\n  display: flex;\n  flex-direction: row;\n}\n\n.item1 {\n  background: red;\n}\n\n.item2 {\n  background: gray;\n}\n\n.item3 {\n  min-width: 1300px;\n  background: greenyellow;\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u6709\u6548\u5730\u4f7f\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u5e76\u968f\u7740\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u53d8\u5316\u800c\u53d8\u5316\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u53d8\u5316\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u8ba9\u5144\u5f1f\u5143\u7d20\u7b49\u5bbd\uff0c\u8ddf\u968f\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\uff1f CSS \u4e2d\u5e38\u89c1\u7684\u8bbe\u8ba1\u9700\u6c42\u662f\u8ba9\u5144\u5f1f\u5143\u7d20\u81ea\u52a8\u5339\u914d\u6700\u957f\u5143\u7d20\u7684\u5bbd\u5ea6\u3002\u8fd9\u901a\u5e38\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u5de7\u5999\u7684\u6280\u5de7\u6765\u89e3\u51b3\u3002 \u8981\u5b9e\u73b0\u6307\u5b9a\u9700\u6c42\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u6cd5\uff1a \u7236\u5bb9\u5668\u8bbe\u7f6e\u4e3a flexbox\uff1a\u5c06\u5144\u5f1f\u5143\u7d20\u7684\u7236\u5bb9\u5668\u8bbe\u7f6e\u6210 flexbox \u5e03\u5c40\uff0c\u5e76\u8bbe\u7f6e flex-direction \u4e3a row\u3002 \u8bbe\u7f6e\u5bbd\u5ea6\u4e3a fit-content\uff1a\u7ed9\u7236\u5bb9\u5668\u8bbe\u7f6e width: fit-content\uff0c\u5b83\u4f1a\u81ea\u52a8\u8c03\u6574\u5bbd\u5ea6\u4ee5\u5bb9\u7eb3\u5b50\u5143\u7d20\u3002 \u989d\u5916\u5305\u88c5\u4e00\u5c42\uff1a\u5728\u7236\u5bb9\u5668\u5916\u90e8\u518d\u5305\u4e00\u5c42 div\uff0c\u907f\u514d\u6eda\u52a8\u6761\u51fa\u73b0\u5728 body \u5143\u7d20\u4e0a\u3002 \u4ee5\u4e0b\u793a\u4f8b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\uff1a &lt;div class=&#8221;wrap&#8221;&gt; &lt;div class=&#8221;container&#8221;&gt; &lt;div class=&#8221;item1&#8243;&gt;item1&lt;\/div&gt; &lt;div class=&#8221;item2&#8243;&gt;item2&lt;\/div&gt; &lt;div class=&#8221;item3&#8243;&gt;item3&lt;\/div&gt; &lt;\/div&gt; &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 .wrap { width: 100%; overflow-x: auto; } .container { width: fit-content; display: flex; flex-direction: row; } .item1 { background: red; } .item2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3338","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=3338"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3338\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}