Margin of parallel boxes (overlap of double margins) interview question: If one box has a top margin and the other box has a bottom margin, will there be a margin overlap problem? Solution: Take the larger value, not the sum of their values, but the one with the larger value will prevail! <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title></title> <style type="text/css"> *{margin: 0;padding: 0;} .box1,.box2{ width: 200px; height: 200px; } .box1{ background-color: #f90; margin-bottom: 20px; } .box2{ background-color: aqua; margin-top: 50px; } </style> </head> <body> <div class="box1"></div> <div class="box2"></div> </body> </html> Margin and padding have the same orientation and value, in clockwise direction (up, right, bottom, left). Click to view "Padding and abbreviations for CSS box model" This is the end of this article about margin values and vertical margin overlap in CSS. For more information about margin and vertical margin overlap, 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! |
<<: HTML cellpadding and cellspacing attributes explained in pictures
>>: How to connect to a remote docker server with a certificate
Sometimes you may need to modify or add exposed p...
<br />The author used to be a novice in web ...
Ubuntu 16.04 builds FTP server Install ftp Instal...
After I published my last article “Zen Coding: A Q...
This article records the detailed tutorial of MyS...
Use anti-shake to make DIV disappear when the mou...
“Inputs should be divided into logical groups so ...
Table of contents LAMP architecture 1.Lamp Introd...
Currently, Docker has an official mirror for Chin...
Table of contents 1. User created script 2. Word ...
<br />Not long ago, due to business needs, I...
Table of contents 1. Shared and Exclusive Locks 2...
Preface In the process of continuous code deliver...
SQLyog connects to mysql error number 1129: mysql...
In js, set the user to read a certain agreement b...