overflow - trigger BFC

1. The full name of BFC is block-level typesetting context, which is used for typesetting block-level elements. By default, only the root element (body) has a block-level context, but if a block-level element is set with float:left, overflow:hidden or position: The absolute style will generate an independent block garbage context for this block-level element. Just like in the window global scope, declaring a function will generate an independent scope. The newly opened BFC seems to be open. A new little universe that makes the typography inside this piece of junk completely isolated.
2. The independent block-level context can wrap the floating flow, and all floating sub-elements will not cause the height of the container to collapse. That is to say, the containing block will also calculate the height of the floating element, so there is no need to clear the float to support the height.




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324938139&siteId=291194637