{"id":52981,"date":"2024-12-03T11:02:25","date_gmt":"2024-12-03T03:02:25","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52981\/"},"modified":"2024-12-03T11:02:25","modified_gmt":"2024-12-03T03:02:25","slug":"overflow%e5%88%9b%e5%bb%ba%e7%9a%84bfc%e5%92%8cfloat%e5%88%9b%e5%bb%ba%e7%9a%84bfc%ef%bc%8c%e5%ae%83%e4%bb%ac%e7%9a%84%e5%b8%83%e5%b1%80%e8%a1%8c%e4%b8%ba%e4%b8%ba%e4%bd%95%e4%b8%8d%e5%90%8c-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52981\/","title":{"rendered":"overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f<\/h1>\n<p>\u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u6253\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aoverflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u300b<\/span>\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\u5427\uff01\u6587\u4e2d\u5185\u5bb9\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9&#8230;\u5e0c\u671b\u4f60\u80fd\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u771f\u771f\u5b9e\u5b9e\u5b66\u5230\u77e5\u8bc6\u6216\u8005\u5e2e\u4f60\u89e3\u51b3\u5fc3\u4e2d\u7684\u7591\u60d1\uff0c\u4e5f\u6b22\u8fce\u5927\u4f6c\u6216\u8005\u65b0\u4eba\u670b\u53cb\u4eec\u591a\u7559\u8a00\u8bc4\u8bba\uff0c\u591a\u7ed9\u5efa\u8bae\uff01\u8c22\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241125\/17325094076743fedf74bd1.jpg\" class=\"aligncenter\" title=\"overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u63d2\u56fe\" alt=\"overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>overflow\u521b\u5efa\u7684BFC\u4e0efloat\u521b\u5efa\u7684BFC\u4e4b\u95f4\u7684\u533a\u522b<\/strong><\/p>\n<p>Overflow\u521b\u5efa\u7684BFC\uff08\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff09\u548cfloat\u521b\u5efa\u7684BFC\u65e8\u5728\u5904\u7406\u5185\u5bb9\u5728\u7279\u5b9a\u533a\u57df\u5185\u7684\u5e03\u5c40\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u7684\u884c\u4e3a\u5374\u5927\u76f8\u5f84\u5ead\u3002<\/p>\n<p><strong>\u6ea2\u51fa\u521b\u5efa\u7684BFC<\/strong><\/p>\n<p>\u4f7f\u7528overflow: hidden\u521b\u5efa\u7684BFC\u4f1a\u521b\u5efa\u4e00\u4e2a\u5f3a\u5236\u5305\u542b\u5757\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u7684\u5bb9\u5668\u3002\u5373\u4f7f\u53f3\u4fa7\u6ca1\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u653e\u7f6e\u5185\u5bb9\uff0c\u6b64BFC\u4ecd\u7136\u5ef6\u4f38\u5230\u56fe\u50cf\u53f3\u4fa7\uff0c\u4ee5\u9002\u5e94\u6587\u672c\u3002<\/p>\n<p><strong>Floated \u521b\u5efa\u7684 BFC<\/strong><\/p>\n<p>\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528float\u521b\u5efa\u7684BFC\u4f1a\u5c06\u5143\u7d20\u4ece\u6b63\u5e38\u6587\u6863\u6d41\u4e2d\u79fb\u9664\u5e76\u5c06\u5176\u653e\u7f6e\u5728\u65c1\u8fb9\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6d6e\u52a8\u5143\u7d20\u4e0d\u5f71\u54cd\u540e\u7eed\u5143\u7d20\u7684\u5e03\u5c40\uff0c\u56e0\u6b64\u6587\u672c\u76f4\u63a5\u663e\u793a\u5728\u56fe\u50cf\u4e0b\u65b9\u3002\u53ea\u6709\u5f53\u6d6e\u52a8\u5143\u7d20\u7684\u5bbd\u5ea6\u51cf\u53bb\u8fb9\u8ddd\u548c\u586b\u5145\u540e\uff0c\u5176\u5185\u5bb9\u8d85\u51fa\u4e86\u53ef\u7528\u7684\u7a7a\u95f4\u65f6\uff0c\u5b83\u624d\u4f1a\u53e6\u8d77\u4e00\u884c\u3002<\/p>\n<p><strong>\u533a\u522b\u7684\u539f\u56e0<\/strong><\/p>\n<p>Overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\u5b83\u4eec\u90fd\u662fBFC\u5e94\u8be5\u6ca1\u6709\u533a\u522b\u3002\u6545\u8fd9\u91cc\u7684\u884c\u4e3a\u4e0d\u540c\u8ddf\u662f\u600e\u4e48\u4ea7\u751f\u7684BFC\u662f\u6ca1\u6709\u5173\u7cfb\u7684\u3002<\/p>\n<p>\u8fd9\u5e94\u8be5\u548cblock width\u7684\u8ba1\u7b97\uff08width:auto or width: fit-content\uff09\u3001float\u5143\u7d20\u6d41\u51fanormal flow\u4ee5\u53cafloat\u4e0e\u4e4b\u540e\u7684bfc\u4e0d\u4f1a\u53d1\u751f\u91cd\u53e0\u6709\u5173\u3002<\/p>\n<ul>\n<li><strong>float\u5143\u7d20\u6d41\u51fanormal flow\uff1a<\/strong>float\u5143\u7d20\u4e0d\u5c5e\u4e8enormal flow\uff0c\u56e0\u6b64\u540e\u7eed\u5143\u7d20\u5c06\u89c6\u5176\u4e0d\u5b58\u5728\u3002<\/li>\n<li><strong>float\u5143\u7d20\u4e0ebfc\u4e0d\u4f1a\u91cd\u53e0\uff1a<\/strong>float\u5143\u7d20\u548c\u76f8\u90bb\u7684bfc\u4e0d\u4f1a\u91cd\u53e0\u3002\u8fd9\u8feb\u4f7fbfc\u53d8\u7a84\uff0c\u5360\u636e\u53ef\u7528\u5269\u4f59\u5bbd\u5ea6\u3002<\/li>\n<li><strong>block width\u7684\u8ba1\u7b97\uff1a<\/strong>\u5982\u679cbfc\u7684\u5bbd\u5ea6\u8bbe\u7f6e\u4e3aauto\uff08\u5373\u201cshrink-to-fit\u201d\u5bbd\u5ea6\uff09\uff0c\u5219\u5f53\u6587\u672c\u5185\u5bb9\u8f83\u957f\u65f6\uff0cbfc\u5c06\u53d8\u7a84\u4ee5\u9002\u5e94\u5bbd\u5ea6\u3002\u7136\u800c\uff0c\u5f53\u6587\u672c\u8f83\u77ed\u65f6\uff0cbfc\u5c06\u6839\u636e\u5185\u5bb9\u786e\u5b9a\u5176\u5bbd\u5ea6\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u5176\u9ad8\u4e8e\u9884\u671f\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u56e0\u7d20\u5171\u540c\u5bfc\u81f4\u4e86float\u521b\u5efa\u7684BFC\u548coverflow\u521b\u5efa\u7684BFC\u5728\u5e03\u5c40\u884c\u4e3a\u4e0a\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300aoverflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u82f9\u679c\u7535\u8111\u5982\u4f55\u8fde\u63a5\u9690\u85cfwifi\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f \u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u6253\u5f00\u4e86\u8fd9\u7bc7\u6587\u7ae0\u300aoverflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u300b\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\u5427\uff01\u6587\u4e2d\u5185\u5bb9\u5305\u542b\u7b49\u7b49\u77e5\u8bc6\u70b9&#8230;\u5e0c\u671b\u4f60\u80fd\u5728\u9605\u8bfb\u672c\u6587\u540e\uff0c\u80fd\u771f\u771f\u5b9e\u5b9e\u5b66\u5230\u77e5\u8bc6\u6216\u8005\u5e2e\u4f60\u89e3\u51b3\u5fc3\u4e2d\u7684\u7591\u60d1\uff0c\u4e5f\u6b22\u8fce\u5927\u4f6c\u6216\u8005\u65b0\u4eba\u670b\u53cb\u4eec\u591a\u7559\u8a00\u8bc4\u8bba\uff0c\u591a\u7ed9\u5efa\u8bae\uff01\u8c22\u8c22\uff01 overflow\u521b\u5efa\u7684BFC\u4e0efloat\u521b\u5efa\u7684BFC\u4e4b\u95f4\u7684\u533a\u522b Overflow\u521b\u5efa\u7684BFC\uff08\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff09\u548cfloat\u521b\u5efa\u7684BFC\u65e8\u5728\u5904\u7406\u5185\u5bb9\u5728\u7279\u5b9a\u533a\u57df\u5185\u7684\u5e03\u5c40\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u7684\u884c\u4e3a\u5374\u5927\u76f8\u5f84\u5ead\u3002 \u6ea2\u51fa\u521b\u5efa\u7684BFC \u4f7f\u7528overflow: hidden\u521b\u5efa\u7684BFC\u4f1a\u521b\u5efa\u4e00\u4e2a\u5f3a\u5236\u5305\u542b\u5757\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u7684\u5bb9\u5668\u3002\u5373\u4f7f\u53f3\u4fa7\u6ca1\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u653e\u7f6e\u5185\u5bb9\uff0c\u6b64BFC\u4ecd\u7136\u5ef6\u4f38\u5230\u56fe\u50cf\u53f3\u4fa7\uff0c\u4ee5\u9002\u5e94\u6587\u672c\u3002 Floated \u521b\u5efa\u7684 BFC \u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528float\u521b\u5efa\u7684BFC\u4f1a\u5c06\u5143\u7d20\u4ece\u6b63\u5e38\u6587\u6863\u6d41\u4e2d\u79fb\u9664\u5e76\u5c06\u5176\u653e\u7f6e\u5728\u65c1\u8fb9\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6d6e\u52a8\u5143\u7d20\u4e0d\u5f71\u54cd\u540e\u7eed\u5143\u7d20\u7684\u5e03\u5c40\uff0c\u56e0\u6b64\u6587\u672c\u76f4\u63a5\u663e\u793a\u5728\u56fe\u50cf\u4e0b\u65b9\u3002\u53ea\u6709\u5f53\u6d6e\u52a8\u5143\u7d20\u7684\u5bbd\u5ea6\u51cf\u53bb\u8fb9\u8ddd\u548c\u586b\u5145\u540e\uff0c\u5176\u5185\u5bb9\u8d85\u51fa\u4e86\u53ef\u7528\u7684\u7a7a\u95f4\u65f6\uff0c\u5b83\u624d\u4f1a\u53e6\u8d77\u4e00\u884c\u3002 \u533a\u522b\u7684\u539f\u56e0 Overflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\u5b83\u4eec\u90fd\u662fBFC\u5e94\u8be5\u6ca1\u6709\u533a\u522b\u3002\u6545\u8fd9\u91cc\u7684\u884c\u4e3a\u4e0d\u540c\u8ddf\u662f\u600e\u4e48\u4ea7\u751f\u7684BFC\u662f\u6ca1\u6709\u5173\u7cfb\u7684\u3002 \u8fd9\u5e94\u8be5\u548cblock width\u7684\u8ba1\u7b97\uff08width:auto or width: fit-content\uff09\u3001float\u5143\u7d20\u6d41\u51fanormal flow\u4ee5\u53cafloat\u4e0e\u4e4b\u540e\u7684bfc\u4e0d\u4f1a\u53d1\u751f\u91cd\u53e0\u6709\u5173\u3002 float\u5143\u7d20\u6d41\u51fanormal flow\uff1afloat\u5143\u7d20\u4e0d\u5c5e\u4e8enormal flow\uff0c\u56e0\u6b64\u540e\u7eed\u5143\u7d20\u5c06\u89c6\u5176\u4e0d\u5b58\u5728\u3002 float\u5143\u7d20\u4e0ebfc\u4e0d\u4f1a\u91cd\u53e0\uff1afloat\u5143\u7d20\u548c\u76f8\u90bb\u7684bfc\u4e0d\u4f1a\u91cd\u53e0\u3002\u8fd9\u8feb\u4f7fbfc\u53d8\u7a84\uff0c\u5360\u636e\u53ef\u7528\u5269\u4f59\u5bbd\u5ea6\u3002 block width\u7684\u8ba1\u7b97\uff1a\u5982\u679cbfc\u7684\u5bbd\u5ea6\u8bbe\u7f6e\u4e3aauto\uff08\u5373\u201cshrink-to-fit\u201d\u5bbd\u5ea6\uff09\uff0c\u5219\u5f53\u6587\u672c\u5185\u5bb9\u8f83\u957f\u65f6\uff0cbfc\u5c06\u53d8\u7a84\u4ee5\u9002\u5e94\u5bbd\u5ea6\u3002\u7136\u800c\uff0c\u5f53\u6587\u672c\u8f83\u77ed\u65f6\uff0cbfc\u5c06\u6839\u636e\u5185\u5bb9\u786e\u5b9a\u5176\u5bbd\u5ea6\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u5176\u9ad8\u4e8e\u9884\u671f\u3002 \u8fd9\u4e9b\u56e0\u7d20\u5171\u540c\u5bfc\u81f4\u4e86float\u521b\u5efa\u7684BFC\u548coverflow\u521b\u5efa\u7684BFC\u5728\u5e03\u5c40\u884c\u4e3a\u4e0a\u7684\u5dee\u5f02\u3002 \u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300aoverflow\u521b\u5efa\u7684BFC\u548cfloat\u521b\u5efa\u7684BFC\uff0c\u5b83\u4eec\u7684\u5e03\u5c40\u884c\u4e3a\u4e3a\u4f55\u4e0d\u540c\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01 \u82f9\u679c\u7535\u8111\u5982\u4f55\u8fde\u63a5\u9690\u85cfwifi\uff1f<\/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-52981","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52981","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=52981"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52981\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}