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
First of all, the blogger is playing the communit...
1. Basic Environment 1. Operating system: CentOS ...
Table of contents Preface cause Phenomenon why? A...
Table of contents Solution, Summarize: vue projec...
Table of contents in conclusion Practice Analysis...
In the UI cutting process, the page is often comp...
Vue+iview menu and tab linkage I am currently dev...
Today we will implement a fragmented image loadin...
In Linux operation and configuration work, dual n...
In HTML, colors are represented in two ways. One i...
Preface First, let's see how to identify a TC...
1. Vulnerability Description On May 15, 2019, Mic...
Table of contents 1. Database master-slave classi...
Preface The this pointer in JS has always been a ...
You can often see articles about CSS drawing, suc...