1. Merge the margins of sibling elements The effect is as follows: (the spacing between the two is 100px, not 150px) 2. Merge the outer margins of nested elements For two nested elements, if there is no content in the parent element or the content is behind the child element and there is no top padding and border, the top margin of the parent element will be merged with the top margin of the child element, and the value will be the largest top margin, which will be used as the top margin of the parent element. Collapse occurs even if the parent element's top margin is 0. (collapse only occurs in the vertical direction) Solution: 1. Define a 1-pixel top border for the parent element. 2. Define a 1-pixel top padding for the parent element. 3. Add overflow:hidden to the parent element; Note that the first and second methods are not good and will increase the size of the box. The third method hides the overflowing content, which neither increases the size of the box nor affects the content. Summarize The above is what I introduced to you about solving the problem of margin merging. 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. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: Faint: "Use web2.0 to create standard-compliant pages"
>>: Detailed explanation of MySQL transaction isolation level and MVCC
Since I found that the push image always timed ou...
VNC is a remote desktop protocol. Follow the inst...
1. Naming conventions 1. Database names, table na...
The project has been suspended recently, and the ...
Table of contents 1. Introduction 2. Several key ...
Table of contents Logical Layering Separate busin...
Table of contents Hbase installation and configur...
Table of contents 1. Prepare the springboot proje...
When you are working on a shared system, you prob...
Table of contents Preface Using websocket Constru...
This article mainly introduces the breadcrumb fun...
Subquery in MySql database: Subquery: nesting ano...
environment Server: centos7 Client: window Deploy...
1. Requirements: Database backup is particularly ...
1. Introduction to LVM When we manage Linux disks...