{"id":10006114,"date":"2022-08-05T13:25:52","date_gmt":"2022-08-05T05:25:52","guid":{"rendered":"https:\/\/ityet.com\/?p=10006114"},"modified":"2022-08-05T13:25:52","modified_gmt":"2022-08-05T05:25:52","slug":"%e9%98%b2%e5%be%a1%e5%bc%8fcss%e6%98%af%e4%bb%80%e4%b9%88%ef%bc%9f%e8%bf%99%e5%87%a0%e7%82%b9%e5%b1%9e%e6%80%a7%e9%87%8d%e7%82%b9%e9%98%b2%e5%be%a1%ef%bc%81","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006114","title":{"rendered":"\u9632\u5fa1\u5f0fCSS\u662f\u4ec0\u4e48\uff1f\u8fd9\u51e0\u70b9\u5c5e\u6027\u91cd\u70b9\u9632\u5fa1\uff01"},"content":{"rendered":"<blockquote><p>\u4f5c\u8005\uff1aAhmad Shadeed<br \/>\u8bd1\u8005\uff1a\u524d\u7aef\u5c0f\u667a<br \/>\u6765\u6e90\uff1aishadeed<\/p><\/blockquote>\n<p>\u65b0\u51fa\u4e86\u4e00\u4e2a\u7cfb\u5217\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=vp6DQ35K4a8EsQM7GPs%2BPg%3D%3D.AG3vn5Z2wDRTKXuA7QneY9guJey%2Fdr%2FYicJywzWj5T1CITL3xiDCLULGpNSzw5RaQd9znL%2FsyiQlULx2exHqTxjtxz5tcKeIx27KRpLZR2D%2F65kGS%2BTy41Red6kb6VAHbSaUdR2JsrOZ7luWXOVPyB05qlaSFiabeSaExO9akeDmtfEXeJDzjMZq9nKLlF1mDW2JrgFibQM5AkjvlL2RY%2Fv8B%2BfHYpYYYT3w2sk2VEdx8lL3vhkT5YDlYynVT%2FiH\" rel=\"nofollow\">Vue2\u4e0eVue3 \u6280\u5de7\u5c0f\u518c<\/a><\/p>\n<blockquote><p>\u5fae\u4fe1\u641c\u7d22 \u3010\u5927\u8fc1\u4e16\u754c\u3011, \u6211\u4f1a\u7b2c\u4e00\u65f6\u95f4\u548c\u4f60\u5206\u4eab\u524d\u7aef\u884c\u4e1a\u8d8b\u52bf\uff0c\u5b66\u4e60\u9014\u5f84\u7b49\u7b49\u3002<br \/>\u672c\u6587 GitHub  <a href=\"https:\/\/link.segmentfault.com\/?enc=bKvZLibJOFTndgbeuo1duA%3D%3D.d4yUrD1vyFAEGH59%2B%2Bta4kfqu829ob2P2Mr%2F4jI5wSkr4EjzCDGINYM%2BMamBCtMM\" rel=\"nofollow\">https:\/\/github.com\/qq449245884\/xiaozhi<\/a> \u5df2\u6536\u5f55\uff0c\u6709\u4e00\u7ebf\u5927\u5382\u9762\u8bd5\u5b8c\u6574\u8003\u70b9\u3001\u8d44\u6599\u4ee5\u53ca\u6211\u7684\u7cfb\u5217\u6587\u7ae0\u3002<\/p><\/blockquote>\n<p>\u5f88\u591a\u65f6\u5019\uff0c\u6211\u4eec\u5e0c\u671b\u6709\u4e00\u79cd\u65b9\u6cd5\u53ef\u4ee5\u907f\u514d\u67d0\u79cdCSS\u95ee\u9898\u6216\u884c\u4e3a\u7684\u53d1\u751f\u3002\u6211\u4eec\u77e5\u9053\uff0c\u7f51\u9875\u5185\u5bb9\u662f\u52a8\u6001\u7684\uff0c\u7f51\u9875\u4e0a\u7684\u4e1c\u897f\u53ef\u4ee5\u6539\u53d8\uff0c\u4ece\u800c\u589e\u52a0\u4e86\u51fa\u73b0CSS\u95ee\u9898\u6216\u5947\u602a\u884c\u4e3a\u7684\u53ef\u80fd\u6027\u3002<\/p>\n<p>\u9632\u5fa1\u5f0f CSS\u662f\u4e00\u4e2a\u7247\u6bb5\u7684\u96c6\u5408\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u7f16\u5199\u53d7\u4fdd\u62a4\u7684CSS\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u5c31\u662f\u5c06\u6765\u4f1a\u6709\u66f4bug\u51fa\u73b0\u3002<\/p>\n<h3>1.Flexbox \u5305\u88f9<\/h3>\n<p>CSS flexbox \u662f\u76ee\u524d\u6700\u6709\u7528\u7684CSS\u5e03\u5c40\u529f\u80fd\u4e4b\u4e00\u3002\u5728\u4e00\u4e2a\u5305\u88c5\u5668\u4e0a\u6dfb\u52a0 <code>display: flex<\/code>\uff0c\u8ba9\u5b50\u9879\u6328\u7740\u6392\u5e8f\u3002<\/p>\n<p>\u95ee\u9898\u662f\uff0c\u5f53\u7a7a\u95f4\u4e0d\u8db3\u65f6\uff0c\u90a3\u4e9b\u5b50\u9879\u9ed8\u8ba4\u4e0d\u4f1a\u88ab\u5305\u88f9\u6210\u4e00\u4e2a\u65b0\u7684\u884c\u3002\u6211\u4eec\u9700\u8981\u7528 <code>flex-wrap: wrap<\/code> \u6765\u6539\u53d8\u8fd9\u4e00\u884c\u4e3a\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5178\u578b\u7684\u4f8b\u5b50\u3002<\/p>\n<pre><code>.options-list {\n    display: flex;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpQk\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5f53\u7a7a\u95f4\u8f83\u5c11\u65f6\uff0c\u4f1a\u51fa\u73b0\u6c34\u5e73\u6eda\u52a8\u3002\u8fd9\u5e94\u8be5\u662f\u9884\u6599\u4e4b\u4e2d\u7684\uff0c\u5b9e\u9645\u4e0a\u5e76\u4e0d\u662f\u4e00\u4e2a &#8220;\u95ee\u9898&#8221;\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5p\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<pre><code>.options-list {\n    display: flex;\n    flex-wrap: wrap;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5o\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4f7f\u7528<code>flexbox<\/code>\u65f6\uff0c\u4e00\u822c\u7684\u7ecf\u9a8c\u6cd5\u5219\u662f\u5141\u8bb8\u5305\u88f9\uff0c\u9664\u975e\u4f60\u60f3\u8981\u4e00\u4e2a\u6eda\u52a8\u7684\u5305\u88f9\u3002\u8fd9\u662f\u53e6\u4e00\u56de\u4e8b\uff0c\u4f46\u5c3d\u91cf\u4f7f\u7528 <code>flex-wrap<\/code> \u6765\u907f\u514d\u610f\u5916\u7684\u5e03\u5c40\u884c\u4e3a\uff08\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0c\u662f\u6c34\u5e73\u6eda\u52a8\uff09\u3002<\/p>\n<h3>2.\u95f4\u8ddd<\/h3>\n<p>\u6211\u4eec\u5f00\u53d1\u8005\u9700\u8981\u8003\u8651\u4e0d\u540c\u7684\u5185\u5bb9\u957f\u5ea6\u3002\u8fd9\u610f\u5473\u7740\uff0c\u95f4\u8ddd\u5e94\u8be5\u6dfb\u52a0\u5230\u7ec4\u4ef6\u4e2d\uff0c\u5373\u4f7f\u5b83\u770b\u8d77\u6765\u4e0d\u9700\u8981\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpQq\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5728\u53f3\u8fb9\u6709\u4e00\u4e2a<code>section<\/code>\u6807\u9898\u548c\u4e00\u4e2a\u64cd\u4f5c\u6309\u94ae\u3002\u76ee\u524d\uff0c\u5b83\u770b\u8d77\u6765\u8fd8\u4e0d\u9519\u3002\u4f46\u662f\uff0c\u5982\u679c\u6807\u9898\u518d\u957f\u4e00\u4e9b\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\u5462?<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5n\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6ce8\u610f\u5230\u6587\u672c\u592a\u9760\u8fd1\u6309\u94ae\u4e86\u5417\uff1f\u8fd9\u91cc\uff0c\u4f60\u53ef\u80fd\u4f1a\u8003\u8651\u591a\u884c\u6362\u884c\uff0c\u4f46\u73b0\u5728\uff0c\u6211\u4eec\u5148\u5173\u6ce8\u8ddd\u3002<\/p>\n<p>\u5982\u679c\u6807\u9898\u6709\u7a7a\u683c\u548c\u6587\u672c\u622a\u65ad\uff0c\u6211\u4eec\u4e0d\u4f1a\u770b\u5230\u8fd9\u6837\u7684\u95ee\u9898\u3002<\/p>\n<pre><code>.section__title {\n    margin-right: 1rem;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5l\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>3.\u957f\u5185\u5bb9<\/h3>\n<p>\u5728\u6784\u5efa\u5e03\u5c40\u65f6\uff0c\u8003\u8651\u5230\u957f\u7684\u5185\u5bb9\u662f\u5f88\u91cd\u8981\u7684\u3002\u6b63\u5982\u4f60\u5728\u524d\u9762\u6240\u770b\u5230\u7684\uff0c\u5f53\u7ae0\u8282\u7684\u6807\u9898\u592a\u957f\u65f6\u5c31\u4f1a\u88ab\u622a\u65ad\u3002\u8fd9\u662f\u53ef\u9009\u7684\uff0c\u4f46\u5bf9\u4e8e\u67d0\u4e9bUI\u6765\u8bf4\uff0c\u8003\u8651\u5230\u8fd9\u4e00\u70b9\u5f88\u91cd\u8981\u3002<\/p>\n<p>\u5bf9\u6211\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u79cd\u9632\u5fa1\u6027\u7684CSS\u65b9\u6cd5\u3002\u5728 &#8220;\u95ee\u9898 &#8220;\u771f\u6b63\u53d1\u751f\u4e4b\u524d\u5c31\u53bb\u89e3\u51b3\u5b83\uff0c\u8fd9\u5f88\u597d\u3002<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4efd\u4eba\u540d\u6e05\u5355\uff0c\u73b0\u5728\u770b\u8d77\u6765\u5f88\u5b8c\u7f8e<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpQ1\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u7136\u800c\uff0c\u7531\u4e8e\u8fd9\u662f\u7528\u6237\u751f\u6210\u7684\u5185\u5bb9\uff0c\u6211\u4eec\u9700\u8981\u5c0f\u5fc3\u5982\u4f55\u9632\u5fa1\u5e03\u5c40\uff0c\u4ee5\u9632\u67d0\u4e9b\u5185\u5bb9\u592a\u957f\u3002\u8bf7\u770b\u4e0b\u56fe:<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpRc\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u8fd9\u79cd\u5e03\u5c40\u4e2d\uff0c\u4e00\u81f4\u6027\u975e\u5e38\u91cd\u8981\u3002\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 <code>text-overflow<\/code>\u548c\u5b83\u7684\u597d\u53cb\u6765\u7b80\u5355\u5730\u622a\u65ad\u540d\u79f0\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5m\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>4. \u9632\u6b62\u56fe\u50cf\u88ab\u62c9\u4f38\u6216\u538b\u7f29<\/h3>\n<p>\u5728\u65e0\u6cd5\u63a7\u5236\u56fe\u7247\u9ad8\u5bbd\u6bd4\u7684\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u7528\u6237\u4e0a\u4f20\u7684\u56fe\u7247\u4e0e\u9ad8\u5bbd\u6bd4\u4e0d\u7b26\uff0c\u6700\u597d\u63d0\u524d\u8003\u8651\u5e76\u63d0\u4f9b\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>\u5728\u4e0b\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6709\u4e00\u4e2a\u5e26\u6709\u7167\u7247\u7684\u5361\u7247\u7ec4\u4ef6\u3002\u5b83\u770b\u8d77\u6765\u4e0d\u9519\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpRq\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5f53\u7528\u6237\u4e0a\u4f20\u4e00\u4e2a\u4e0d\u540c\u5927\u5c0f\u7684\u56fe\u50cf\u65f6\uff0c\u5b83\u5c06\u88ab\u62c9\u4f38\u3002\u8fd9\u53ef\u4e0d\u662f\u4ec0\u4e48\u597d\u4e8b\u3002\u770b\u770b\u56fe\u50cf\u662f\u5982\u4f55\u88ab\u62c9\u4f38\u7684!<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5q\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6700\u7b80\u5355\u7684\u4fee\u590d\u65b9\u6cd5\u662f\u4f7f\u7528CSS <code>object-fit<\/code>\u3002<\/p>\n<pre><code>.card__thumb {\n    object-fit: cover;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpRr\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u9879\u76ee\u5c42\u9762\u4e0a\uff0c\u6211\u503e\u5411\u4e8e\u4e3a<strong>\u6240\u6709\u56fe\u50cf<\/strong>\u6dfb\u52a0 <code>object-fit<\/code>\uff0c\u4ee5\u907f\u514d\u51fa\u73b0\u610f\u5916\u7684\u7ed3\u679c\u3002<\/p>\n<h3>5.\u9501\u5b9a\u6eda\u52a8\u94fe\u63a5<\/h3>\n<p>\u4f60\u662f\u5426\u66fe\u7ecf\u6253\u5f00\u4e00\u4e2a\u6a21\u6001\u5e76\u5f00\u59cb\u6eda\u52a8\uff0c\u7136\u540e\u5f53\u4f60\u5230\u8fbe\u7ec8\u70b9\u5e76\u7ee7\u7eed\u6eda\u52a8\u65f6\uff0c\u6a21\u6001\u4e0b\u9762\u7684\u5185\u5bb9\uff08\u4e3b\u4f53\u5143\u7d20\uff09\u4f1a\u6eda\u52a8\uff1f\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u6eda\u52a8\u94fe\u3002<\/p>\n<blockquote><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53\u89e6\u53ca\u9875\u9762\u9876\u90e8\u6216\u8005\u5e95\u90e8\u65f6\uff08\u6216\u8005\u662f\u5176\u4ed6\u53ef\u6eda\u52a8\u533a\u57df\uff09\uff0c\u79fb\u52a8\u7aef\u6d4f\u89c8\u5668\u503e\u5411\u4e8e\u63d0\u4f9b\u4e00\u79cd\u201c\u89e6\u5e95\u201d\u6548\u679c\uff0c\u751a\u81f3\u8fdb\u884c\u9875\u9762\u5237\u65b0\u3002\u4f60\u53ef\u80fd\u4e5f\u53d1\u73b0\u4e86\uff0c\u5f53\u5bf9\u8bdd\u6846\u4e2d\u542b\u6709\u53ef\u6eda\u52a8\u5185\u5bb9\u65f6\uff0c\u4e00\u65e6\u6eda\u52a8\u81f3\u5bf9\u8bdd\u6846\u7684\u8fb9\u754c\uff0c\u5bf9\u8bdd\u6846\u4e0b\u65b9\u7684\u9875\u9762\u5185\u5bb9\u4e5f\u5f00\u59cb\u6eda\u52a8\u4e86\u2014\u2014\u8fd9\u88ab\u79f0\u4e3a\u201c\u6eda\u52a8\u94fe\u201d\u3002 \u3002<\/p><\/blockquote>\n<p>\u5728\u8fc7\u53bb\u7684\u51e0\u5e74\u91cc\uff0c\u6709\u4e00\u4e9b\u9ed1\u79d1\u6280\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u4f46\u73b0\u5728\uff0c\u6211\u4eec\u53ea\u9700\u8981\u4f7f\u7528CSS \u5373\u53ef\uff0c\u8fd9\u8981\u611f\u8c22<code>overscroll-behavior<\/code> CSS\u5c5e\u6027\u3002<\/p>\n<p>\u5728\u4e0b\u9762\u7684\u56fe\u4e2d\uff0c\u53ef\u4ee5\u770b\u5230\u9ed8\u8ba4\u7684\u6eda\u52a8\u94fe\u63a5\u884c\u4e3a\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpRZ\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e3a\u4e86\u63d0\u524d\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u6dfb\u52a0\u5230\u4efb\u4f55\u9700\u8981\u6eda\u52a8\u7684\u7ec4\u4ef6\u4e2d\uff08\u4f8b\u5982\uff1a\u804a\u5929\u7ec4\u4ef6\u3001\u79fb\u52a8\u83dc\u5355&#8230;\u7b49\uff09\u3002\u8fd9\u4e2a\u5c5e\u6027\u7684\u597d\u5904\u662f\uff0c\u5728\u6709\u6eda\u52a8\u4e4b\u524d\uff0c\u5b83\u4e0d\u4f1a\u4ea7\u751f\u5f71\u54cd\u3002<\/p>\n<pre><code>.modal__content {\n    overscroll-behavior-y: contain;\n    overflow-y: auto;\n}<\/code><\/pre>\n<h3>6. CSS\u53d8\u91cf\u56de\u9000<\/h3>\n<p>CSS\u53d8\u91cf\u5728\u7f51\u9875\u8bbe\u8ba1\u4e2d\u5f97\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u5e94\u7528\u3002\u6211\u4eec\u53ef\u4ee5\u5e94\u7528\u4e00\u79cd\u65b9\u6cd5\uff0c\u5728CSS\u53d8\u91cf\u503c\u56e0\u67d0\u79cd\u539f\u56e0\u4e3a\u7a7a\u7684\u60c5\u51b5\u4e0b\uff0c\u4ee5\u4e00\u79cd\u4e0d\u7834\u574f\u4f53\u9a8c\u7684\u65b9\u5f0f\u4f7f\u7528\u5b83\u4eec\u3002<\/p>\n<p>\u901a\u8fc7 JS \u8f93\u5165CSS\u53d8\u91cf\u7684\u503c\u65f6\u7279\u522b\u6709\u7528\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50:<\/p>\n<pre><code>.message__bubble {\n    max-width: calc(100% - var(--actions-width));\n}<\/code><\/pre>\n<p>\u53d8\u91cf <code>--actions-width<\/code> \u5728 <code>calc()<\/code> \u51fd\u6570\u4e2d\u88ab\u4f7f\u7528\uff0c\u5176\u503c\u6765\u81ea JS\u3002\u5047\u8bbe JS \u7531\u4e8e\u67d0\u79cd\u539f\u56e0\u5931\u8d25\u4e86\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<code>max-width<\/code> \u4f1a\u88ab\u8ba1\u7b97\u4e3a\u96f6\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u63d0\u524d\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u5728 <code>var()<\/code> \u4e2d\u6dfb\u52a0\u4e00\u4e2a\u56de\u9000\u503c\u3002<\/p>\n<pre><code>.message__bubble {\n    max-width: calc(100% - var(--actions-width, 70px));\n}<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u5982\u679c\u53d8\u91cf\u6ca1\u6709\u5b9a\u4e49\uff0c\u5c31\u4f1a\u4f7f\u7528\u56de\u9000 <code>(70px)<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5728\u53d8\u91cf\u53ef\u80fd\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u3002<\/p>\n<h3>7.\u4f7f\u7528\u56fa\u5b9a\u5bbd\u5ea6\u6216\u9ad8\u5ea6<\/h3>\n<p>\u7834\u574f\u5e03\u5c40\u7684\u5e38\u89c1\u60c5\u51b5\u4e4b\u4e00\u662f\u5bf9\u4e00\u4e2a\u6709\u4e0d\u540c\u957f\u5ea6\u5185\u5bb9\u7684\u5143\u7d20\u4f7f\u7528\u56fa\u5b9a\u7684\u5bbd\u5ea6\u6216\u9ad8\u5ea6\u3002<\/p>\n<h4>\u56fa\u5b9a\u9ad8\u5ea6<\/h4>\n<p>\u6211\u7ecf\u5e38\u770b\u5230\u4e3b\u5185\u5bb9\u90e8\u5206\u6709\u56fa\u5b9a\u7684\u9ad8\u5ea6\uff0c\u800c\u5185\u5bb9\u5374\u5927\u4e8e\u8fd9\u4e2a\u9ad8\u5ea6\uff0c\u8fd9\u5c31\u5bfc\u81f4\u4e86\u5e03\u5c40\u7684\u7834\u574f\u3002\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code>.main {\n    height: 350px;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5k\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u51fa\u73b0\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>min-height<\/code> \u4ee3\u66ff <code>height<\/code>:<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5i\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h4>\u56fa\u5b9a\u5bbd\u5ea6<\/h4>\n<p>\u4f60\u6709\u6ca1\u6709\u89c1\u8fc7\u6309\u94ae\uff0c\u5b83\u7684\u6807\u7b7e\u79bb\u5de6\u53f3\u8fb9\u7f18\u592a\u8fd1\uff1f\u8fd9\u662f\u7531\u4e8e\u4f7f\u7528\u4e86\u56fa\u5b9a\u5bbd\u5ea6\u3002<\/p>\n<pre><code>.button {\n    width: 100px;\n}<\/code><\/pre>\n<p>\u5982\u679c\u6309\u94ae\u7684\u6807\u7b7e\u5927\u4e8e<code>100px<\/code>\uff0c\u5b83\u5c06\u9760\u8fd1\u8fb9\u7f18\u3002\u5982\u679c\u5b83\u592a\u957f\uff0c\u6587\u672c\u4f1a\u6cc4\u9732\u51fa\u6765\u3002\u8fd9\u662f\u4e0d\u597d\u7684\uff01<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpSy\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u5730\u7528 <code>min-width<\/code> \u4ee3\u66ff <code>width<\/code>\u3002<\/p>\n<pre><code>.button {\n    min-width: 100px;\n}<\/code><\/pre>\n<h3>8.\u5fd8\u8bb0 background-Repeat<\/h3>\n<p>\u5f88\u591a\u65f6\u5019\uff0c\u5f53\u4f7f\u7528\u4e00\u5f20\u5927\u7684\u56fe\u7247\u4f5c\u4e3a\u80cc\u666f\u65f6\uff0c\u6211\u4eec\u5f80\u5f80\u4f1a\u5fd8\u8bb0\u8003\u8651\u8bbe\u8ba1\u5728\u5927\u5c4f\u5e55\u4e0a\u89c2\u770b\u65f6\u7684\u60c5\u51b5\u3002\u8be5\u80cc\u666f\u5c06\u9ed8\u8ba4\u91cd\u590d\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5h\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u5728\u7b14\u8bb0\u672c\u5c4f\u5e55\u4e0a\u5927\u591a\u4e0d\u4f1a\u770b\u5230\uff0c\u4f46\u5728\u5927\u5c4f\u5e55\u4e0a\u5f88\u5e38\u89c1\u3002<\/p>\n<p>\u4e3a\u4e86\u63d0\u524d\u907f\u514d\u8fd9\u79cd\u884c\u4e3a\uff0c\u8bf7\u786e\u4fdd\u4f7f\u7528\u91cd\u7f6e <code>background-repeat<\/code>\u3002<\/p>\n<pre><code>.hero {\n    background-image: url('..');\n    background-repeat: no-repeat;\n}<\/code><\/pre>\n<h3>9.\u5782\u76f4\u5a92\u4f53\u67e5\u8be2<\/h3>\n<p>\u6709\u65f6\uff0c\u6211\u4eec\u5f88\u60f3\u5efa\u7acb\u4e00\u4e2a\u7ec4\u4ef6\uff0c\u53ea\u901a\u8fc7\u8c03\u6574\u6d4f\u89c8\u5668\u7684\u5bbd\u5ea6\u8fdb\u884c\u6d4b\u8bd5\u3002\u6839\u636e\u6d4f\u89c8\u5668\u7684\u9ad8\u5ea6\u8fdb\u884c\u6d4b\u8bd5\u53ef\u4ee5\u53d1\u73b0\u4e00\u4e9b\u6709\u8da3\u7684\u95ee\u9898\u3002<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u6211\u89c1\u8fc7\u591a\u6b21\u7684\u4f8b\u5b50\u3002\u6211\u4eec\u6709\u4e00\u4e2a\u5e26\u6709\u4e3b\u8981\u548c\u6b21\u8981\u94fe\u63a5\u7ec4\u4ef6\u3002\u6b21\u8981\u94fe\u63a5\u5e94\u8be5\u4f4d\u4e8e\u65c1\u767d\u90e8\u5206\u7684\u6700\u5e95\u90e8\u3002<\/p>\n<p>\u8003\u8651\u4e00\u4e0b\u4e0b\u9762\u7684\u4f8b\u5b50\u3002\u4e3b\u5bfc\u822a\u548c\u6b21\u5bfc\u822a\u770b\u8d77\u6765\u8fd8\u4e0d\u9519\u3002\u5728\u6211\u770b\u5230\u7684\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5f00\u53d1\u8005\u7ed9\u4e8c\u7ea7\u5bfc\u822a\u6dfb\u52a0\u4e86 <code>position: sticky<\/code>\uff0c\u8fd9\u6837\u5b83\u5c31\u53ef\u4ee5\u7c98\u5728\u5e95\u90e8\u4e86\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5e\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u7136\u800c\uff0c\u5982\u679c\u6d4f\u89c8\u5668\u7684\u9ad8\u5ea6\u8f83\u5c0f\uff0cbug \u5c31\u6765\u4e86\u3002\u6ce8\u610f\u8fd9\u4e24\u4e2a\u5bfc\u822a\u662f\u5982\u4f55\u91cd\u53e0\u7684\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5d\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u901a\u8fc7\u4f7f\u7528CSS\u5782\u76f4\u5a92\u4f53\u67e5\u8be2\uff0c\u6211\u4eec\u53ef\u4ee5\u907f\u514d\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<pre><code>@media (min-height: 600px) {\n    .aside__secondary {\n        position: sticky;\n        bottom: 0;\n    }\n}<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u53ea\u6709\u5f53\u89c6\u53e3\u9ad8\u5ea6\u5927\u4e8e\u6216\u7b49\u4e8e<code>600px<\/code> \u65f6\uff0c\u4e8c\u7ea7\u5bfc\u822a\u624d\u4f1a\u88ab\u7c98\u5728\u5e95\u90e8\u3002\u597d\u591a\u4e86\uff0c\u5bf9\u5417\uff1f<\/p>\n<p>\u53ef\u80fd\u6709\u66f4\u597d\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u8fd9\u4e00\u884c\u4e3a\uff08\u6bd4\u5982\u4f7f\u7528 <code>margin-auto<\/code>\uff09\uff0c\u4f46\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\u4e13\u6ce8\u4e8e\u5782\u76f4\u67e5\u8be2\u3002<\/p>\n<h3>10. \u4f7f\u7528 justify-content:space-between<\/h3>\n<p>\u5728\u4e00\u4e2a <code>flex<\/code> \u7684\u5bb9\u5668\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u4f7f\u7528 <code>justify-content<\/code> \u6765\u4f7f\u5b50\u9879\u76ee\u4e4b\u95f4\u6709\u4e00\u5b9a\u7684\u95f4\u8ddd\u3002\u5982\u679c\u6709\u4e00\u5b9a\u6570\u91cf\u7684\u5b50\u9879\u76ee\uff0c\u5e03\u5c40\u770b\u8d77\u6765\u4f1a\u5f88\u597d\u3002\u7136\u800c\uff0c\u5f53\u5b83\u4eec\u589e\u52a0\u6216\u51cf\u5c11\u65f6\uff0c\u5e03\u5c40\u4f1a\u770b\u8d77\u6765\u5f88\u5947\u602a\u3002<\/p>\n<p>\u8003\u8651\u4ee5\u4e0b\u4f8b\u5b50:<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5b\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6211\u4eec\u6709\u4e00\u4e2a\u6709\u56db\u4e2a\u9879\u76ee\u7684 flex \u5bb9\u5668\u3002\u6bcf\u4e2a\u9879\u76ee\u4e4b\u95f4\u7684\u95f4\u8ddd\u4e0d\u662f <code>gap<\/code> \u6216 <code>margin<\/code>\uff0c\u5b83\u4e4b\u6240\u4ee5\u5b58\u5728\u662f\u56e0\u4e3a\u5bb9\u5668\u6709 <code>justify-content: space-between<\/code>\u3002<\/p>\n<pre><code>.wrapper {\n    display: flex;\n    flex-wrap: wrap;\n    justify-content: space-between;\n}<\/code><\/pre>\n<p>\u5f53\u9879\u76ee\u7684\u6570\u91cf\u5c11\u4e8e4\u4e2a\u65f6\uff0c\u5c06\u53d1\u751f\u4ee5\u4e0b\u60c5\u51b5\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5a\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u5e76\u4e0d\u662f\u597d\u4e8b\u3002\u5bf9\u6b64\u6709\u4e0d\u540c\u7684\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>margin<\/li>\n<li>flexbox gap\uff08\u8c28\u614e\u4f7f\u7528\uff09<\/li>\n<li>padding\uff08\u53ef\u5e94\u7528\u4e8e\u6bcf\u4e2a\u5b50\u5143\u7d20\u7684\u7236\u5143\u7d20\uff09<\/li>\n<li>\u589e\u52a0\u7a7a\u7684\u5143\u7d20\uff0c\u4f5c\u4e3a\u95f4\u9694\u3002<\/li>\n<\/ul>\n<p>\u4e3a\u4e86\u7b80\u5355\u8d77\u89c1\uff0c\u6211\u4f7f\u7528 <code>gap<\/code>\u3002<\/p>\n<pre><code>.wrapper {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 1rem;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB49\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>11. \u56fe\u7247\u4e0a\u7684\u6587\u5b57<\/h3>\n<p>\u5f53\u5728\u56fe\u7247\u4e0a\u653e\u7f6e\u6587\u672c\u65f6\uff0c\u5fc5\u987b\u8003\u8651\u5230\u56fe\u50cf\u65e0\u6cd5\u52a0\u8f7d\u7684\u60c5\u51b5\u3002\u6587\u672c\u4f1a\u662f\u4ec0\u4e48\u6837\u5b50\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpUp\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6587\u672c\u770b\u8d77\u6765\u662f\u53ef\u8bfb\u7684\uff0c\u4f46\u5f53\u56fe\u50cf\u52a0\u8f7d\u5931\u8d25\u65f6\uff0c\u5b83\u7684\u53ef\u8bfb\u6027\u53d8\u5f97\u5f88\u5dee\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpUu\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6211\u4eec\u901a\u8fc7\u7ed9<code>&lt;img&gt;<\/code>\u5143\u7d20\u6dfb\u52a0\u4e00\u4e2a\u80cc\u666f\u8272\u6765\u8f7b\u677e\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u8fd9\u4e2a\u80cc\u666f\u53ea\u6709\u5728\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\u65f6\u624d\u4f1a\u663e\u793a\u51fa\u6765\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB5f\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>12.\u5c0f\u5fc3CSS\u7f51\u683c\u4e2d\u7684\u56fa\u5b9a\u503c<\/h3>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5305\u542b<code>aside<\/code>\u548c<code>main<\/code>\u7684\u7f51\u683c\u3002CSS\u770b\u8d77\u6765\u662f\u8fd9\u6837\u7684:<\/p>\n<pre><code>.wrapper {\n    display: grid;\n    grid-template-columns: 250px 1fr;\n    gap: 1rem;\n}<\/code><\/pre>\n<p>\u7531\u4e8e\u7f3a\u4e4f\u7a7a\u95f4\uff0c\u8fd9\u5728\u5c0f\u7684\u89c6\u53e3\u5c3a\u5bf8\u4e0a\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u5728\u4f7f\u7528\u4e0a\u8ff0CSS\u7f51\u683c\u65f6\uff0c\u4e00\u5b9a\u8981\u4f7f\u7528\u5a92\u4f53\u67e5\u8be2\u3002<\/p>\n<pre><code>@media (min-width: 600px) {\n    .wrapper {\n        display: grid;\n        grid-template-columns: 250px 1fr;\n        gap: 1rem;\n    }\n}<\/code><\/pre>\n<h3>13.\u53ea\u5728\u9700\u8981\u7684\u65f6\u5019\u663e\u793a\u6eda\u52a8\u6761<\/h3>\n<p>\u6211\u4eec\u53ef\u4ee5\u63a7\u5236\u663e\u793a\u6eda\u52a8\u6761\u6216\u4e0d\u53ea\u662f\u5728\u6709\u5f88\u957f\u7684\u5185\u5bb9\u7684\u60c5\u51b5\u4e0b\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u5f3a\u70c8\u5efa\u8bae\u4f7f\u7528<code>auto<\/code>\u4f5c\u4e3a<code>overflow<\/code>\u7684\u503c\u3002\u8003\u8651\u4ee5\u4e0b\u4f8b\u5b50:<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpUN\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u5373\u4f7f\u5185\u5bb9\u5f88\u77ed\uff0c\u4e5f\u6709\u4e00\u4e2a\u6eda\u52a8\u6761\u53ef\u89c1\u3002\u8fd9\u5bf9\u4e00\u4e2a\u7528\u6237\u754c\u9762\u6765\u8bf4\u5e76\u4e0d\u662f\u597d\u4e8b\u3002\u4f5c\u4e3a\u7528\u6237\uff0c\u5728\u4e0d\u9700\u8981\u6eda\u52a8\u6761\u7684\u60c5\u51b5\u4e0b\u770b\u5230\u6eda\u52a8\u6761\u662f\u5f88\u6df7\u4e71\u7684\u3002<\/p>\n<pre><code>.element {\n    overflow-y: auto;\n}<\/code><\/pre>\n<p>\u4f7f\u7528<code>overflow-y: auto<\/code>\uff0c\u6eda\u52a8\u6761\u53ea\u6709\u5728\u5185\u5bb9\u8f83\u957f\u65f6\u624d\u53ef\u89c1\u3002\u5426\u5219\uff0c\u5b83\u5c31\u4e0d\u663e\u793a\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpUU\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h4>14.Scrollbar Gutter<\/h4>\n<p>\u53e6\u4e00\u4ef6\u4e0e\u6eda\u52a8\u6709\u5173\u7684\u4e8b\u60c5\u662f <code>Scrollbar Gutter<\/code>\u3002\u4ee5\u524d\u9762\u7684\u4f8b\u5b50\u4e3a\u4f8b\uff0c\u5f53\u5185\u5bb9\u53d8\u957f\u65f6\uff0c\u589e\u52a0\u4e00\u4e2a\u6eda\u52a8\u6761\u4f1a\u5bfc\u81f4\u5e03\u5c40\u7684\u8f6c\u79fb\u3002\u5e03\u5c40\u79fb\u52a8\u53d1\u751f\u7684\u539f\u56e0\u662f\u4e3a\u6eda\u52a8\u6761\u4fdd\u7559\u4e86\u4e00\u4e2a\u7a7a\u95f4\u3002<\/p>\n<blockquote><p>Scrollbar Gutter \u662f\u5185\u8fb9\u6846\u8fb9\u7f18\u548c\u5916\u586b\u5145\u8fb9\u7f18\u4e4b\u95f4\u7684\u7a7a\u95f4\u3002 \u5bf9\u4e8e\u7ecf\u5178\u6eda\u52a8\u6761\uff0cScrollbar Gutter \u7684\u5927\u5c0f\u4e0e\u6eda\u52a8\u6761\u7684\u5bbd\u5ea6\u76f8\u540c\u3002 \u8fd9\u4e9b\u6eda\u52a8\u6761\u901a\u5e38\u662f\u4e0d\u900f\u660e\u7684\uff0c\u5e76\u4ece\u76f8\u90bb\u7684\u5185\u5bb9\u4e2d\u5360\u7528\u4e00\u4e9b\u7a7a\u95f4\u3002<\/p><\/blockquote>\n<p>\u8bf7\u770b\u4e0b\u56fe:<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcXpVj\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u7531\u4e8e\u663e\u793a\u4e86\u6eda\u52a8\u6761\uff0c\u5f53\u5185\u5bb9\u53d8\u957f\u65f6\uff0c\u5b83\u662f\u5982\u4f55\u79fb\u4f4d\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<code>scrollbar-gutter<\/code>\u5c5e\u6027\u6765\u907f\u514d\u8fd9\u79cd\u884c\u4e3a\u3002<\/p>\n<pre><code>.element {\n    scrollbar-gutter: stable;\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB48\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>15. CSS Flexbox\u4e2d\u7684\u6700\u5c0f\u5185\u5bb9\u5c3a\u5bf8<\/h3>\n<p>\u5982\u679c\u4e00\u4e2a flex \u9879\u76ee\u4e2d\u7684\u6587\u672c\u5143\u7d20\u6216\u56fe\u50cf\u5927\u4e8e\u6216\u957f\u4e8e\u8be5\u9879\u76ee\u672c\u8eab\uff0c\u6d4f\u89c8\u5668\u5c31\u4e0d\u4f1a\u7f29\u5c0f\u5b83\u4eec\u3002\u8fd9\u662fFlexbox \u7684\u9ed8\u8ba4\u884c\u4e3a\u3002\u8003\u8651\u4ee5\u4e0b\u4f8b\u5b50\uff1a<\/p>\n<pre><code>.card {\n    display: flex;\n}<\/code><\/pre>\n<p>\u5f53\u6807\u9898\u6709\u4e00\u4e2a\u5f88\u957f\u7684\u8bcd\u65f6\uff0c\u5b83\u4e0d\u4f1a\u88ab\u5305\u6210\u4e00\u4e2a\u65b0\u884c\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB45\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5373\u4f7f\u6211\u4eec\u4f7f\u7528 <code>overflow-wrap: break-word<\/code>\uff0c\u4e5f\u4e0d\u4f1a\u8d77\u4f5c\u7528\u3002<\/p>\n<pre><code>.card__title {\n    overflow-wrap: break-word;\n}<\/code><\/pre>\n<p>\u8981\u6539\u53d8\u8fd9\u79cd\u9ed8\u8ba4\u884c\u4e3a\uff0c\u6211\u4eec\u9700\u8981\u5c06 <code>flex<\/code> \u9879\u76ee\u7684 <code>min-width<\/code> \u8bbe\u7f6e\u4e3a <code>0<\/code>\u3002 \u8fd9\u662f\u56e0\u4e3a <code>min-width<\/code> \u7684\u9ed8\u8ba4\u503c\u662f <code>auto<\/code>\uff0c\u6ea2\u51fa\u4f1a\u53d1\u751f\u3002<\/p>\n<pre><code>.card__title {\n    overflow-wrap: break-word;\n    min-width: 0;\n}<\/code><\/pre>\n<p>\u540c\u6837\u4e5f\u9002\u7528\u4e8e <code>flex-direction:column<\/code> \u5e03\u5c40\uff0c\u5bf9\u5e94\u7684\u4f7f\u7528 <code>min-height: 0<\/code>\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB46\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>16. CSS\u7f51\u683c\u4e2d\u7684\u6700\u5c0f\u5185\u5bb9\u5c3a\u5bf8<\/h3>\n<p>\u4e0eflexbox\u7c7b\u4f3c\uff0cCSS grid\u5bf9\u5176\u5b50\u9879\u76ee\u6709\u4e00\u4e2a\u9ed8\u8ba4\u7684\u6700\u5c0f\u5185\u5bb9\u5c3a\u5bf8\uff0c\u5373<code>auto<\/code>\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5982\u679c\u6709\u4e00\u4e2a\u5143\u7d20\u6bd4\u7f51\u683c\u9879\u5927\uff0c\u5b83\u5c06\u6ea2\u51fa\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB44\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5728\u4e3b\u90e8\u5206\u4e2d\u6709\u4e00\u4e2a <code>carousel<\/code>\u3002<\/p>\n<pre><code>&lt;div class=&quot;wrapper&quot;&gt;\n    &lt;main&gt;\n        &lt;section class=&quot;carousel&quot;&gt;&lt;\/section&gt;\n    &lt;\/main&gt;\n    &lt;aside&gt;&lt;\/aside&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<pre><code>@media (min-width: 1020px) {\n    .wrapper {\n        display: grid;\n        grid-template-columns: 1fr 248px;\n        grid-gap: 40px;\n    }\n}\n\n.carousel {\n    display: flex;\n    overflow-x: auto;\n}<\/code><\/pre>\n<p>\u7531\u4e8e <code>carousel<\/code>\u662f\u4e00\u4e2a flex \u5e03\u5c40\uff0c\u5f53\u5185\u5bb9\u8d85\u51fa\u65f6\uff0c\u9ed8\u8ba4\u662f\u4e0d\u4f1a\u6362\u884c\u7684\uff0c\u6240\u4ee5\u4f1a\u51fa\u73b0\u6c34\u5e73\u6eda\u52a8\u7684\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u6709\u4e09\u79cd\u4e0d\u540c\u7684\u89e3\u51b3\u65b9\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528 <code>minmax()<\/code><\/li>\n<li>\u5c06 <code>min-width<\/code> \u5e94\u7528\u4e8e\u7f51\u683c\u9879\u76ee<\/li>\n<li>\u5728\u7f51\u7edc\u4e2d\u6dfb\u52a0 <code>overflow: hidden<\/code><\/li>\n<\/ul>\n<p>\u4f5c\u4e3a\u4e00\u79cd\u9632\u5fa1\u6027\u7684CSS\u673a\u5236\uff0c\u6211\u4f1a\u9009\u62e9\u7b2c\u4e00\u79cd\uff0c\u5373\u4f7f\u7528 <code>minmax()<\/code> \u51fd\u6570\u3002<\/p>\n<pre><code>@media (min-width: 1020px) {\n    .wrapper {\n        display: grid;\n        grid-template-columns: minmax(0, 1fr) 248px;\n        grid-gap: 40px;\n    }\n}<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB43\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<ol start=\"17\">\n<li>\n<h3>Auto Fit Vs Auto Fill<\/h3>\n<\/li>\n<\/ol>\n<p>\u5728\u4f7f\u7528CSS\u7f51\u683c <code>minmax()<\/code> \u51fd\u6570\u65f6\uff0c\u51b3\u5b9a\u4f7f\u7528 <code>auto-fit<\/code> \u8fd8\u662f <code>auto-fill<\/code> \u7684\u5173\u952e\u5b57\u5f88\u91cd\u8981\u3002\u4e00\u65e6\u4f7f\u7528\u4e0d\u5f53\uff0c\u4f1a\u5bfc\u81f4\u610f\u5916\u7684\u7ed3\u679c\u3002<\/p>\n<p>\u5f53\u4f7f\u7528<code>minmax()<\/code>\u51fd\u6570\u65f6\uff0c<code>auto-fit<\/code>\u5173\u952e\u5b57\u5c06\u6269\u5c55\u7f51\u683c\u9879\u76ee\u4ee5\u586b\u8865\u53ef\u7528\u7a7a\u95f4\u3002\u800c<code>auto-fill<\/code>\u5c06\u4fdd\u7559\u53ef\u7528\u7684\u7a7a\u95f4\uff0c\u800c\u4e0d\u6539\u53d8\u7f51\u683c\u9879\u7684\u5bbd\u5ea6\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcWB41\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u4f7f\u7528<code>auto-fit<\/code>\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7f51\u683c\u9879\u76ee\u592a\u5bbd\uff0c\u7279\u522b\u662f\u5f53\u5b83\u4eec\u5c0f\u4e8e\u9884\u671f\u65f6\u3002\u8003\u8651\u4e00\u4e0b\u4e0b\u9762\u7684\u4f8b\u5b50\u3002<\/p>\n<hr>\n<p><strong>\u7f16\u8f91\u4e2d\u53ef\u80fd\u5b58\u5728\u7684bug\u6ca1\u6cd5\u5b9e\u65f6\u77e5\u9053\uff0c\u4e8b\u540e\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9bbug,\u82b1\u4e86\u5927\u91cf\u7684\u65f6\u95f4\u8fdb\u884clog \u8c03\u8bd5\uff0c\u8fd9\u8fb9\u987a\u4fbf\u7ed9\u5927\u5bb6\u63a8\u8350\u4e00\u4e2a\u597d\u7528\u7684BUG\u76d1\u63a7\u5de5\u5177 <a href=\"https:\/\/link.segmentfault.com\/?enc=N2s4c%2Bkx3tGNJxn5Hff1%2BA%3D%3D.tpnr6jbhM3MMz95sr648vkw%2FmF8Aik6JMofGb7FJ8nrEY4vNrhgQ0c6iyQJR4O%2FS\" rel=\"nofollow\">Fundebug<\/a>\u3002<\/strong><\/p>\n<p>\u539f\u8c05\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=24%2FNiVlkivpa0fl7T9ry1w%3D%3D.%2BzJ1p7s4VQVrtDDji0L5lgCLdWx%2F7Z8T5bb4lNXgVLmy4m95YQVSzKxWnDR%2FYHRS\" rel=\"nofollow\">https:\/\/ishadeed.com\/article\/&#8230;<\/a><\/p>\n<h3>\u4ea4\u6d41<\/h3>\n<blockquote>\n<p>\u6709\u68a6\u60f3\uff0c\u6709\u5e72\u8d27\uff0c\u5fae\u4fe1\u641c\u7d22 <strong>\u3010\u5927\u8fc1\u4e16\u754c\u3011<\/strong> \u5173\u6ce8\u8fd9\u4e2a\u5728\u51cc\u6668\u8fd8\u5728\u5237\u7897\u7684\u5237\u7897\u667a\u3002<\/p>\n<p>\u672c\u6587 GitHub  <a href=\"https:\/\/link.segmentfault.com\/?enc=SVYXNwGVeYHlSeOzeop07A%3D%3D.%2FI61On9XQ%2FLY%2BlA%2FE1K%2F%2B7H%2FlKdc9t5Nr5imhSfUvUrJyHU4ob7di1lrEPSaMBV0\" rel=\"nofollow\">https:\/\/github.com\/qq449245884\/xiaozhi<\/a> \u5df2\u6536\u5f55\uff0c\u6709\u4e00\u7ebf\u5927\u5382\u9762\u8bd5\u5b8c\u6574\u8003\u70b9\u3001\u8d44\u6599\u4ee5\u53ca\u6211\u7684\u7cfb\u5217\u6587\u7ae0\u3002<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000020353567?w=800&#038;h=400\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042272755\">https:\/\/segmentfault.com\/a\/1190000042272755<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1aAhmad Shadeed\u8bd1\u8005\uff1a\u524d\u7aef\u5c0f\u667a\u6765\u6e90\uff1aishadeed \u65b0\u51fa\u4e86\u4e00\u4e2a\u7cfb\u5217\uff1aVue2\u4e0eVue3 \u6280\u5de7 [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006114","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006114"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006114\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}