Home > Article > Web Front-end > How to play bfc in css? _html/css_WEB-ITnose
First of all, let’s understand a concept. What is bfc?
This is how w3c explains it
BFC (Block Formatting Context) is the CSS rendering mode for box model layout in web pages. Its positioning system belongs to the regular document flow.
To put it simply:
The value of float is not none
The value of position is not static or relative
The value of display is table-cell, table-caption, inline-block, The value of one of the
overflow in flex, or inline-flex is not visible
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> .column{ width: 31.33%; background-color: aqua; float: left; margin: 0.1%; color: #fff; padding: 10px 0; } .column:last-child{ float: none; /* overflow: hidden;*/ } </style></head><body> <div class="container"> <div class="column">11</div> <div class="column">22</div> <div class="column">33</div> </div></body></html>
The above code adds overflow: hidden so a new bfc module will be formed.
After understanding the concept, I have to get to the bottom of many layouts and understand the principles, such as how to calculate margins, and the margins should be larger up and down, left and right. What kind of layout like avatar on the left, text on the right, etc.
For more details, see: http://www.w3cplus.com/css/understanding-block-formatting-contexts-in-css.html
Copyright Disclaimer: This article is an original article by the blogger and may not be reproduced without the blogger's permission.