BFC Concept: The block formatting context is an independent rendering area that isolates the elements inside the BFC from the elements outside it, so that the positioning of the internal and external elements will not affect each other. Let us first understand a term: BFC (block formatting context), which means "block-level formatting context" in Chinese. First remember a principle: If an element has a BFC, then no matter how the internal elements change, it will not affect the external elements. Therefore, it is impossible for BFC elements to have margin overlap, because margin overlap will affect the elements outside; BFC elements can also be used to clear the impact of floating, because if it is not cleared, the floating of child elements will cause the height of the parent element to collapse, which will inevitably affect the layout and positioning of the subsequent elements, which is obviously contrary to the setting that the child elements of the BFC element will not affect the external elements. The following situations trigger the BFC: • <html> root element Obviously, when we set the overflow value to hidden and make the container element have BFC, the floating of the child element child will not cause the height collapse of the parent element. Use pseudo-class elements to clear floating: .clearFix::after, .clearFix::before { display: block; content: ''; clear: both; visibility: hidden; height: 0; } .clearFix { zoom: 1;} Summarize The above is the CSS method of using pseudo-elements to clear floating that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time! |
<<: Two ways to use IIS to call X-Forwarded-For Header (XFF) to record the visitor's real IP
>>: Web Design Experience: Self-righteous Web Designers
It is very common to use webpack to build single-...
Table of contents What is cgroup Composition of c...
I searched for many ways to change it online but ...
Programs in Docker containers often need to acces...
Tabs: Category + Description Tag bar: Category =&...
Preface This article contains 1. Several major co...
Use examples to familiarize yourself with the mean...
If you want to install some 64-bit applications (...
If you have just come into contact with Linux, th...
Without further ado, I will post the code for you...
This post focuses on a super secret Flutter proje...
Hardware View Commands system # uname -a # View k...
Table of contents Prefab How to create a prefab T...
First execute the command: [root@mini61 setuptool...
With the emergence of docker, many services have ...