Non-orthogonal margins When margin is used, it will cause merging The following properties will prevent margin merging: border display: table display: flex The above content is the result of the detailed explanation below Blocking merger [Detailed explanation] /* CSS */ .box{ border:1px solid red; height: 100px; margin: 10px; /* Note: this is 10 pixels! */ } <!-- HTML --> <div class="box"></div> <div class="box"></div> <div class="box"></div> This is what it looks like in the browser: According to the rational number margin, the spacing between the top and bottom of the div should be 20px Solution 1: <!-- HTML --> <!-- css unchanged --> <div class="box"></div> <div style="border: 1px solid blue"></div> <!-- Newly added --> <div class="box"></div> <div style="border: 0.1px solid blue"></div> <!-- Newly added --> <div class="box"></div> <div class="box"></div> This is what it looks like in the browser: <!-- HTML --> <!-- css unchanged --> <!-- HTML --> <div class="box"></div> <div style="display: table"></div> <div class="box"></div> <div style="display: flex"></div> <div class="box"></div> <div class="box"></div> <!-- display:block / inline will not block merging, only table flex can --> This is what it looks like in the browser: Other Impacts display will affect the small dots of ul li position: absolute will affect display: inline position: fixed will affect transform float affects inline The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Detailed explanation of creating, calling and managing MySQL stored procedures
>>: Usage of the target attribute of the html tag a
Mobile Mobile pages only need to be compatible wi...
Replication is to transfer the DDL and DML operat...
Preface When writing front-end pages, we often us...
Table of contents Scenario Code Implementation Su...
Traditionally, developers create properties in Ja...
Closure implementation of private variables Priva...
Preface In MySQL, cross-database queries are main...
Since there is a button in my company's produ...
Table of contents Introduction Step 1 Step 2: Cre...
When building a B/S system interface, you often en...
The ps command in Linux is the abbreviation of Pr...
Table of contents Writing Background Project Desc...
Preface As we all know, JavaScript is single-thre...
1. Cleaning before installation rpm -qa | grep jd...
If the program service is deployed using k8s inte...