awesome-interview/assets/js/57076a74.1d980d9a.js

1 line
20 KiB
JavaScript

"use strict";(self.webpackChunkjjbook=self.webpackChunkjjbook||[]).push([[8721],{3905:function(t,e,n){n.d(e,{Zo:function(){return u},kt:function(){return k}});var l=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,l)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e){if(null==t)return{};var n,l,r=function(t,e){if(null==t)return{};var n,l,r={},a=Object.keys(t);for(l=0;l<a.length;l++)n=a[l],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(l=0;l<a.length;l++)n=a[l],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=l.createContext({}),c=function(t){var e=l.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},u=function(t){var e=c(t.components);return l.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return l.createElement(l.Fragment,{},e)}},s=l.forwardRef((function(t,e){var n=t.components,r=t.mdxType,a=t.originalType,p=t.parentName,u=i(t,["components","mdxType","originalType","parentName"]),s=c(n),k=r,d=s["".concat(p,".").concat(k)]||s[k]||m[k]||a;return n?l.createElement(d,o(o({ref:e},u),{},{components:n})):l.createElement(d,o({ref:e},u))}));function k(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var a=n.length,o=new Array(a);o[0]=s;var i={};for(var p in e)hasOwnProperty.call(e,p)&&(i[p]=e[p]);i.originalType=t,i.mdxType="string"==typeof t?t:r,o[1]=i;for(var c=2;c<a;c++)o[c]=n[c];return l.createElement.apply(null,o)}return l.createElement.apply(null,n)}s.displayName="MDXCreateElement"},1163:function(t,e,n){n.r(e),n.d(e,{frontMatter:function(){return i},contentTitle:function(){return p},metadata:function(){return c},toc:function(){return u},default:function(){return s}});var l=n(7462),r=n(3366),a=(n(7294),n(3905)),o=["components"],i={sidebar_label:"\u6837\u5f0f\uff1aBFC \u7684\u5f62\u6210\u548c\u4f5c\u7528",sidebar_position:8},p="BFC \u7684\u5f62\u6210\u548c\u4f5c\u7528",c={unversionedId:"book1/css-bfc",id:"book1/css-bfc",isDocsHomePage:!1,title:"BFC \u7684\u5f62\u6210\u548c\u4f5c\u7528",description:"\u76f8\u5173\u95ee\u9898",source:"@site/docs/book1/css-bfc.md",sourceDirName:"book1",slug:"/book1/css-bfc",permalink:"/awesome-interview/book1/css-bfc",tags:[],version:"current",sidebarPosition:8,frontMatter:{sidebar_label:"\u6837\u5f0f\uff1aBFC \u7684\u5f62\u6210\u548c\u4f5c\u7528",sidebar_position:8},sidebar:"tutorialSidebar",previous:{title:"\u57fa\u7840\uff1a\u524d\u7aef\u6a21\u5757\u5316\u89c4\u8303",permalink:"/awesome-interview/book1/js-module-specs"},next:{title:"\u7f51\u7edc\uff1a\u524d\u7aef\u5b89\u5168",permalink:"/awesome-interview/book1/network-security"}},u=[{value:"\u76f8\u5173\u95ee\u9898",id:"\u76f8\u5173\u95ee\u9898",children:[]},{value:"\u56de\u7b54\u5173\u952e\u70b9",id:"\u56de\u7b54\u5173\u952e\u70b9",children:[]},{value:"\u77e5\u8bc6\u70b9\u6df1\u5165",id:"\u77e5\u8bc6\u70b9\u6df1\u5165",children:[{value:"1. \u524d\u7f6e\u77e5\u8bc6\u70b9",id:"1-\u524d\u7f6e\u77e5\u8bc6\u70b9",children:[]},{value:"2. \u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\uff08visual formatting model\uff09",id:"2-\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578bvisual-formatting-model",children:[]}]},{value:"\u53c2\u8003\u8d44\u6599",id:"\u53c2\u8003\u8d44\u6599",children:[]}],m={toc:u};function s(t){var e=t.components,n=(0,r.Z)(t,o);return(0,a.kt)("wrapper",(0,l.Z)({},m,n,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"bfc-\u7684\u5f62\u6210\u548c\u4f5c\u7528"},"BFC \u7684\u5f62\u6210\u548c\u4f5c\u7528"),(0,a.kt)("h2",{id:"\u76f8\u5173\u95ee\u9898"},"\u76f8\u5173\u95ee\u9898"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"BFC \u6709\u4ec0\u4e48\u7528\uff0c\u5982\u4f55\u89e6\u53d1"),(0,a.kt)("li",{parentName:"ul"},"\u8c08\u8c08\u4f60\u5bf9 BFC \u7684\u7406\u89e3")),(0,a.kt)("h2",{id:"\u56de\u7b54\u5173\u952e\u70b9"},"\u56de\u7b54\u5173\u952e\u70b9"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"\u76d2\u6a21\u578b")," ",(0,a.kt)("inlineCode",{parentName:"p"},"\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b")," ",(0,a.kt)("inlineCode",{parentName:"p"},"\u5305\u542b\u5757")," ",(0,a.kt)("inlineCode",{parentName:"p"},"\u6b63\u5e38\u6d41")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"BFC \u662f\u4ec0\u4e48")),(0,a.kt)("p",null,"BFC \u5168\u79f0\u4e3a block formatting context\uff0c\u4e2d\u6587\u4e3a\u201c\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u201d\u3002\u5b83\u662f\u4e00\u4e2a\u53ea\u6709\u5757\u7ea7\u76d2\u5b50\u53c2\u4e0e\u7684\u72ec\u7acb\u5757\u7ea7\u6e32\u67d3\u533a\u57df\uff0c\u5b83\u89c4\u5b9a\u4e86\u5185\u90e8\u7684\u5757\u7ea7\u76d2\u5b50\u5982\u4f55\u5e03\u5c40\uff0c\u4e14\u4e0e\u533a\u57df\u5916\u90e8\u65e0\u5173\u3002"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"BFC \u6709\u4ec0\u4e48\u7528")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"\u4fee\u590d\u6d6e\u52a8\u5143\u7d20\u9020\u6210\u7684\u9ad8\u5ea6\u584c\u9677\u95ee\u9898\u3002"),(0,a.kt)("li",{parentName:"ul"},"\u907f\u514d\u975e\u671f\u671b\u7684\u5916\u8fb9\u8ddd\u6298\u53e0\u3002"),(0,a.kt)("li",{parentName:"ul"},"\u5b9e\u73b0\u7075\u6d3b\u5065\u58ee\u7684\u81ea\u9002\u5e94\u5e03\u5c40\u3002")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u89e6\u53d1 BFC \u7684\u5e38\u89c1\u6761\u4ef6")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"<","html",">"," \u6839\u5143\u7d20\u3002"),(0,a.kt)("li",{parentName:"ul"},"float \u7684\u503c\u4e0d\u4e3a none\u3002"),(0,a.kt)("li",{parentName:"ul"},"position \u7684\u503c\u4e0d\u4e3a relative \u6216 static\u3002"),(0,a.kt)("li",{parentName:"ul"},"overflow \u7684\u503c\u4e0d\u4e3a visible \u6216 clip\uff08\u9664\u4e86\u6839\u5143\u7d20\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"display \u7684\u503c\u4e3a table-cell\uff0ctable-caption\uff0c\u6216 inline-block \u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u3002"),(0,a.kt)("li",{parentName:"ul"},"display \u7684\u503c\u4e3a flow-root\uff0c\u6216 display \u503c\u4e3a flow-root list-item\u3002"),(0,a.kt)("li",{parentName:"ul"},"flex items\uff0c\u5373 display \u7684\u503c\u4e3a flex \u6216 inline-flex \u7684\u5143\u7d20\u7684\u76f4\u63a5\u5b50\u5143\u7d20\uff08\u8be5\u5b50\u5143\u7d20 display \u4e0d\u4e3a flex\uff0cgrid\uff0c\u6216 table\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"grid items\uff0c\u5373 display \u7684\u503c\u4e3a grid \u6216 inline-grid \u7684\u5143\u7d20\u7684\u76f4\u63a5\u5b50\u5143\u7d20\uff08\u8be5\u5b50\u5143\u7d20 display \u4e0d\u4e3a flex\uff0cgrid\uff0c\u6216 table\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"contain \u7684\u503c\u4e3a layout\uff0ccontent\uff0cpaint\uff0c\u6216 strict \u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u3002"),(0,a.kt)("li",{parentName:"ul"},"column-span \u8bbe\u7f6e\u4e3a all \u7684\u5143\u7d20\u3002")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u63d0\u793a"),"\uff1a",(0,a.kt)("inlineCode",{parentName:"p"},"display: flow-root"),"\uff0c",(0,a.kt)("inlineCode",{parentName:"p"},"contain: layout")," \u7b49\u662f\u65e0\u526f\u4f5c\u7528\u7684\uff0c\u53ef\u5728\u4e0d\u5f71\u54cd\u5df2\u6709\u5e03\u5c40\u7684\u60c5\u51b5\u4e0b\u89e6\u53d1 BFC\u3002"),(0,a.kt)("h2",{id:"\u77e5\u8bc6\u70b9\u6df1\u5165"},"\u77e5\u8bc6\u70b9\u6df1\u5165"),(0,a.kt)("h3",{id:"1-\u524d\u7f6e\u77e5\u8bc6\u70b9"},"1. \u524d\u7f6e\u77e5\u8bc6\u70b9"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u76d2\u6a21\u578b\uff08box model\uff09")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u76d2\u6a21\u578b"),"\u63cf\u8ff0\u4e86\u4e00\u4e2a\u7531\u5143\u7d20\u751f\u6210\u7684\u77e9\u5f62\u76d2\u5b50\uff0c",(0,a.kt)("strong",{parentName:"p"},"\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b"),"\u51b3\u5b9a\u8fd9\u4e9b\u76d2\u5b50\u7684\u5927\u5c0f\u3001\u4f4d\u7f6e\u4ee5\u53ca\u5c5e\u6027\uff08\u4f8b\u5982\u989c\u8272\u3001\u80cc\u666f\u3001\u8fb9\u6846\u5c3a\u5bf8\u7b49\u7b49\uff09\u3002"),(0,a.kt)("p",null,"\u76d2\u5b50\u7684\u5177\u4f53\u6784\u6210\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://www.w3.org/TR/CSS2/images/boxdim.png",alt:"Box model"})),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u672f\u8bed\u89e3\u6790")),(0,a.kt)("p",null,"\u7531\u4e8e\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\u63cf\u8ff0\u4e2d\uff0c\u6709\u8bb8\u591a\u76f8\u8fd1\u7684\u672f\u8bed\uff0c\u5728\u6b64\u5148\u884c\u5217\u51fa\u89e3\u91ca\u3002"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"box\uff08\u76d2\u5b50\uff09\uff1a\u4e00\u4e2a\u62bd\u8c61\u6982\u5ff5\uff0c\u5728\u753b\u5e03\u4e0a\u5360\u636e\u4e00\u5757\u7a7a\u95f4\uff0c\u901a\u5e38\u7531\u5143\u7d20\uff08element\uff09\u751f\u6210\u3002\u4e00\u4e2a\u5143\u7d20\u53ef\u80fd\u751f\u6210\u591a\u4e2a\u76d2\u5b50\uff08\u5982\u4f2a\u5143\u7d20\u3001list-item \u5143\u7d20\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"principal box\uff08\u4e3b\u8981\u76d2\u5b50\uff09\uff1a\u5143\u7d20\u751f\u6210\u7684\u591a\u4e2a\u76d2\u5b50\u4e2d\uff0c\u7528\u6765\u5305\u542b\u5b83\u7684\u540e\u4ee3\u76d2\u5b50\u548c\u5b83\u751f\u6210\u7684\u5185\u5bb9\u7684\u76d2\u5b50\uff0c\u4e5f\u662f\u53c2\u4e0e\u4efb\u4f55\u5b9a\u4f4d\u65b9\u6848\u7684\u76d2\u5b50\u3002"),(0,a.kt)("li",{parentName:"ul"},"block-level box\uff08\u5757\u7ea7\u76d2\u5b50\uff09\uff1a\u53c2\u4e0e BFC \u5e03\u5c40\u7684\u76d2\u5b50\uff0c\u901a\u5e38\u7531\u5757\u7ea7\u5143\u7d20\u751f\u6210\u3002"),(0,a.kt)("li",{parentName:"ul"},"block container box\uff08\u5757\u5bb9\u5668\uff09\uff1a\u5728 CSS2.2 \u4e2d\uff0c\u9664\u4e86 table box \u6216\u66ff\u6362\u5143\u7d20\u7684\u4e3b\u8981\u76d2\u5b50\uff0c\u4e00\u4e2a\u5757\u7ea7\u76d2\u5b50\u4e5f\u662f\u5757\u5bb9\u5668\uff0c\u4f46\u4e0d\u662f\u6240\u6709\u7684\u5757\u5bb9\u5668\u90fd\u662f\u5757\u7ea7\u76d2\u5b50\uff08\u5982\u975e\u66ff\u6362\u5185\u8054\u5757\u76d2\u5b50\uff09\u3002\u5757\u5bb9\u5668\u4e3b\u8981\u4fa7\u91cd\u4e8e\u5176\u5b50\u5143\u7d20\u7684\u5b9a\u4f4d\u3001\u5e03\u5c40\u3002"),(0,a.kt)("li",{parentName:"ul"},"block box\uff08\u5757\u76d2\u5b50\uff09\uff1a\u5982\u679c\u4e00\u4e2a\u5757\u7ea7\u76d2\u5b50\u540c\u65f6\u4e5f\u662f\u5757\u5bb9\u5668\uff0c\u5219\u53ef\u4ee5\u79f0\u4f5c\u5757\u76d2\u5b50\u3002"),(0,a.kt)("li",{parentName:"ul"},"block\uff08\u5757\uff09\uff1a\u5f53\u6ca1\u6709\u6b67\u4e49\u65f6\uff0c\u4f5c\u4e3a block box, block-level box \u6216 block container box \u7684\u7b80\u5199\u3002")),(0,a.kt)("p",null,"\uff08\u6ce8\uff1a\u76d2\u5b50\u6709\u201c\u5757\u76d2\u5b50\u201d\u548c\u201c\u5757\u7ea7\u76d2\u5b50\u201d\uff0c\u5143\u7d20\u53ea\u6709\u201c\u5757\u7ea7\u5143\u7d20\u201d\uff0c\u800c\u6ca1\u6709\u201c\u5757\u5143\u7d20\u201d\uff09"),(0,a.kt)("h3",{id:"2-\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578bvisual-formatting-model"},"2. \u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\uff08visual formatting model\uff09"),(0,a.kt)("p",null,"\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\u63cf\u8ff0\u4e86\u7528\u6237\u4ee3\u7406\uff08\u5982\u6d4f\u89c8\u5668\uff09\u5728\u53ef\u89c6\u5316\u5a92\u4f53\uff08\u5982\u663e\u793a\u5668\uff09\u4e0a\u5904\u7406\u6587\u6863\u6811\uff08document tree\uff09\u7684\u8fc7\u7a0b\u3002\u4e0b\u9762\u5404\u5c0f\u8282\u662f\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\u4e2d\u4e0e BFC \u5f3a\u76f8\u5173\u7684\u63cf\u8ff0\uff1a"),(0,a.kt)("h4",{id:"21-\u5305\u542b\u5757containing-block"},"2.1 \u5305\u542b\u5757\uff08containing block\uff09"),(0,a.kt)("p",null,"\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u5305\u542b\u5757\u662f\u4e00\u4e2a\u7531\u5143\u7d20\u6700\u8fd1\u7684\u7956\u5148\u5757\u5bb9\u5668\u7684\u5185\u5bb9\u533a\u57df\uff08content area\uff09\u786e\u5b9a\u7684\u77e9\u5f62\u533a\u57df\uff0c\u5305\u542b\u5757\u672c\u8eab\u4e0d\u662f\u76d2\u5b50\uff0c\u662f\u4e00\u4e2a\u77e9\u5f62\u533a\u57df\u3002\u5143\u7d20\u7684\u5927\u5c0f\uff0c\u4f4d\u7f6e\uff0c\u53ca\u504f\u79fb\u7b49\u5e03\u5c40\u4fe1\u606f\u6839\u636e\u5305\u542b\u5757\u7684\u5c3a\u5bf8\u8fdb\u884c\u8ba1\u7b97\u3002"),(0,a.kt)("h4",{id:"22-\u6b63\u5e38\u6d41normal-flow"},"2.2 \u6b63\u5e38\u6d41\uff08normal flow\uff09"),(0,a.kt)("p",null,"\u6b63\u5e38\u6d41\u662f\u6d4f\u89c8\u5668\u7684\u9ed8\u8ba4\u5e03\u5c40\u65b9\u5f0f\u3002\u5728\u6b63\u5e38\u6d41\u4e2d\u7684\u76d2\u5b50\uff0c\u5c5e\u4e8e BFC\uff0cIFC\uff0c\u6216\u5176\u4ed6\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u4e4b\u4e00\u3002"),(0,a.kt)("h4",{id:"23-\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587formatting-context"},"2.3 \u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08formatting context\uff09"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587"),"\u662f\u4e00\u7cfb\u5217\u76f8\u5173\u76d2\u5b50\u8fdb\u884c\u5e03\u5c40\u7684\u73af\u5883\u3002\u4e0d\u540c\u7684\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u6709\u4e0d\u540c\u7684\u5e03\u5c40\u89c4\u5219\u3002\u76ee\u524d\u5e38\u89c1\u7684\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u6709\u4ee5\u4e0b\u8fd9\u4e9b\uff1a"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08BFC\uff0cblock formatting context\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"\u5185\u8054\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08IFC\uff0cinline formatting context\uff09\u3002"),(0,a.kt)("li",{parentName:"ul"},"\u5f39\u6027\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08FFC\uff0cflex formatting context\uff09\uff0c\u5728 CSS3 \u4e2d\u5b9a\u4e49\u3002"),(0,a.kt)("li",{parentName:"ul"},"\u6805\u683c\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08GFC\uff0cgrid formatting context\uff09\uff0c\u5728 CSS3 \u4e2d\u5b9a\u4e49\u3002")),(0,a.kt)("h4",{id:"24-\u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587independent-formatting-context"},"2.4 \u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff08independent formatting context\uff09"),(0,a.kt)("p",null,"\u4e00\u4e2a\u76d2\u5b50\u8981\u4e48\u5efa\u7acb\u4e00\u4e2a\u65b0\u7684\u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\uff0c\u8981\u4e48\u5ef6\u7eed\u5176\u5305\u542b\u5757\u7684\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u3002\u9664\u4e86\u7279\u6b8a\u8bf4\u660e\uff0c\u5efa\u7acb\u65b0\u7684\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u5c31\u662f\u5728\u5efa\u7acb\u4e00\u4e2a\u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u3002"),(0,a.kt)("p",null,"\u5f53\u4e00\u4e2a\u76d2\u5b50\u5efa\u7acb\u4e00\u4e2a\u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u65f6\uff0c\u5b83\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u72ec\u7acb\u5e03\u5c40\u73af\u5883\u3002\u9664\u4e86\u901a\u8fc7\u6539\u53d8\u76d2\u5b50\u672c\u8eab\u7684\u5927\u5c0f\uff0c\u76d2\u5b50\u5185\u90e8\u7684\u540e\u4ee3\u4e0d\u4f1a\u5f71\u54cd\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u5916\u90e8\u7684\u89c4\u5219\u548c\u5185\u5bb9\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002"),(0,a.kt)("h4",{id:"25-\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u89c4\u8303\u53ca\u89e3\u6790"},"2.5 \u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587\u89c4\u8303\u53ca\u89e3\u6790"),(0,a.kt)("p",null,"\u6839\u636e W3C CSS2.1 \u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\u4e00\u7ae0\u7684\u5b9a\u4e49\uff0cBFC \u76f8\u5173\u89c4\u8303\u63cf\u8ff0\u5982\u4e0b\uff1a"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"\u6d6e\u52a8\u5143\u7d20\uff0c\u7edd\u5bf9\u5b9a\u4f4d\u5143\u7d20\uff0c\u4e0d\u662f\u5757\u7ea7\u76d2\u5b50\u7684\u5757\u7ea7\u5bb9\u5668\uff08\u5982 inline-block\uff0ctable-cells\uff0ctable-captions\uff09\u4ee5\u53ca overflow \u503c\u4e0d\u4e3a visible \u7684\u5757\u7ea7\u76d2\u5b50\uff0c\u90fd\u4f1a\u4e3a\u4ed6\u4eec\u7684\u5185\u5bb9\u521b\u5efa BFC\uff08\u6ce8\uff1a\u89e6\u53d1 BFC \u7684\u6761\u4ef6\uff09\u3002"),(0,a.kt)("li",{parentName:"ol"},"\u5728 BFC \u4e2d\uff0c\u76d2\u5b50\u4ece\u5305\u542b\u5757\u7684\u9876\u90e8\u5f00\u59cb\uff0c\u5728\u5782\u76f4\u65b9\u5411\u4e0a\u4e00\u4e2a\u63a5\u4e00\u4e2a\u7684\u6392\u5217\u3002\u76f8\u90bb\u76d2\u5b50\u4e4b\u95f4\u7684\u5782\u76f4\u95f4\u9699\u7531\u5b83\u4eec\u7684 margin \u503c\u51b3\u5b9a\u3002\u5728\u540c\u4e00\u4e2a BFC \u4e2d\uff0c\u76f8\u90bb\u5757\u7ea7\u76d2\u5b50\u7684\u5782\u76f4\u5916\u8fb9\u8ddd\u4f1a\u5408\u5e76\uff08\u6ce8\uff1a\u53c2\u4e0e BFC \u5e03\u5c40\u7684\u90fd\u662f\u5757\u7ea7\u5143\u7d20\uff09\u3002"),(0,a.kt)("li",{parentName:"ol"},"\u5728 BFC \u4e2d\uff0c\u6bcf\u4e00\u4e2a\u76d2\u5b50\u7684\u5de6\u5916\u8fb9\u7f18\uff08margin-left\uff09\u4f1a\u89e6\u78b0\u5230\u5305\u542b\u5757\u7684\u5de6\u8fb9\u7f18\u3002\u5373\u4f7f\u662f\u5b58\u5728\u6d6e\u52a8\u5143\u7d20\u4e5f\u662f\u5982\u6b64\uff0c\u9664\u975e\u8be5\u76d2\u5b50\u5efa\u7acb\u4e86\u4e00\u4e2a\u65b0\u7684 BFC\u3002")),(0,a.kt)("p",null,"\u7ed3\u5408\u89c4\u8303\u7b2c\u4e09\u70b9\u4e0e",(0,a.kt)("strong",{parentName:"p"},"\u72ec\u7acb\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587"),"\u7684\u77e5\u8bc6\uff0c\u6211\u4eec\u53ef\u4ee5\u6709\u4ee5\u4e0b\u63a8\u8bba\uff1a"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"BFC \u5185\u5916\u4e92\u4e0d\u5f71\u54cd\u3002",(0,a.kt)("ol",{parentName:"li"},(0,a.kt)("li",{parentName:"ol"},"BFC \u5305\u542b\u5185\u90e8\u7684\u6d6e\u52a8\uff08\u89e3\u51b3\u5185\u90e8\u6d6e\u52a8\u5143\u7d20\u5bfc\u81f4\u7684\u9ad8\u5ea6\u584c\u9677\uff09\u3002"),(0,a.kt)("li",{parentName:"ol"},"BFC \u6392\u65a5\u5916\u90e8\u7684\u6d6e\u52a8\uff08\u89e6\u53d1 BFC \u7684\u5143\u7d20\u4e0d\u4f1a\u548c\u5916\u90e8\u7684\u6d6e\u52a8\u5143\u7d20\u91cd\u53e0\uff09\u3002"),(0,a.kt)("li",{parentName:"ol"},"\u5916\u8fb9\u8ddd\u6298\u53e0\u7684\u8ba1\u7b97\u4e0d\u80fd\u8de8\u8d8a BFC \u7684\u8fb9\u754c\u3002"))),(0,a.kt)("li",{parentName:"ol"},"\u5404\u81ea\u521b\u5efa\u4e86 BFC \u7684\u5144\u5f1f\u5143\u7d20\u4e92\u4e0d\u5f71\u54cd\uff08\u6ce8\uff1a\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u591a\u4e2a\u6d6e\u52a8\u5143\u7d20\u52a0\u4e00\u4e2a\u6216\u96f6\u4e2a\u89e6\u53d1 BFC \u7684\u5143\u7d20\u53ef\u4ee5\u5f62\u6210\u591a\u5217\u5e03\u5c40\uff09\u3002")),(0,a.kt)("p",null,"\u901a\u8fc7 BFC \u53ef\u4ee5\u5b9e\u73b0\u7075\u6d3b\u5065\u58ee\u7684\u81ea\u9002\u5e94\u5e03\u5c40\uff0c\u5728\u4e00\u884c\u4e2d\u8fbe\u5230\u7c7b\u4f3c flexbox \u7684\u6548\u679c\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://codepen.io/suzukaze-yoru/pen/ZEKKxJm?editors=1100"},"\u4e24\u680f\u81ea\u9002\u5e94\u5e03\u5c40")),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://user-images.githubusercontent.com/4338052/126038001-1828c607-212c-4427-9006-6ee61f1c3979.gif",alt:"two-col"})),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://codepen.io/suzukaze-yoru/pen/poPPLWZ?editors=1100"},"\u591a\u5217\u81ea\u9002\u5e94\u5e03\u5c40")),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://user-images.githubusercontent.com/4338052/126038024-1160aa58-d21d-48a0-b076-650c4ba6f00d.gif",alt:"multi-col"})),(0,a.kt)("h2",{id:"\u53c2\u8003\u8d44\u6599"},"\u53c2\u8003\u8d44\u6599"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout/Intro_to_formatting_contexts"},"\u5757\u7ea7\u683c\u5f0f\u5316\u4e0a\u4e0b\u6587")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/en-us/docs/web/css/containing_block"},"\u5305\u542b\u5757\uff1aMDN")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://www.w3.org/tr/css22/visudet.html#containing-block-details"},"\u5305\u542b\u5757\uff1aW3C")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/en-us/docs/web/css/visual_formatting_model"},"\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\uff1aMDN")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://www.w3.org/tr/css22/visuren.html"},"\u89c6\u89c9\u683c\u5f0f\u5316\u6a21\u578b\uff1aW3C")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/en-us/docs/web/css/css_box_model/introduction_to_the_css_box_model"},"\u76d2\u6a21\u578b\uff1aMDN")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("a",{parentName:"li",href:"https://www.w3.org/tr/css22/box.html"},"\u76d2\u6a21\u578b\uff1aW3C"))))}s.isMDXComponent=!0}}]);