The HTML structure is as follows: The CCS structure is as follows: The page effect diagram is as follows: Now we can see that 50px to the right and 50px to the bottom are clearly set in the child element, but the effect displayed on the page is only moving to the right but not downward. Generally speaking, Margin-top: 50px, but the page has no effect, which means that the margin has collapsed. So what is margin collapse? When setting When we adjust margin-top: 50px to a height greater than the parent element, the child element will no longer be positioned relative to the parent element but will move 150px downwards with the parent element relative to the browser. To solve the margin collapse problem, we need to use the concept of bfc: BFC stands for The elements that trigger bfc are:
The CSS structure is as follows: The page effect is as follows: Any of the above lines can make up for the problem of margin collapse~ Summarize This is the end of this article about margin: top collapse in CCS. For more relevant CCS margin: top collapse content, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Unicode signature BOM detailed description
>>: The difference between Vue interpolation expression and v-text directive
1. How MySQL uses indexes Indexes are used to qui...
The download address of FlashFXP is: https://www....
Table of contents Conclusion first question Solut...
Scenario: The interaction methods between parent ...
Table of contents Overview Canvas API: Drawing Gr...
Preface Since errors always occur, record the pro...
The following script is used for scheduled backup...
Table of contents Preface Common methods 1. Modif...
border-radius: CSS3 rounded corners Syntax: borde...
What is JConsole JConsole was introduced in Java ...
Recently, the server has been frequently cracked ...
Real-time replication is the most important way t...
Ubuntu's own source is from China, so the dow...
Installing and deploying a private Docker Registr...
Table of contents Introduction: Installation of e...