How to solve the problem of margin-top delivery
This article mainly introduces the relevant knowledge of how to solve the transmission problem of margin-top, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this margin-top transmission problem. Let's take a look at it.
The transfer problem of margin-top
Phenomenon: after margin-top is added to the child element by default, the browser will pass this upper spacing to the parent element when parsing, causing the parent element to be displayed on the page.
Solution:
a. Add a border-top to the nearest parent element
b. Add overflow:hidden; to the parent element (overflow hiding)
.fu {
Width:300px
Height:300px
Background-color:orange
Border-top:1px solid transparent; / * Top frame solid line transparent color * /
/ * the second method, overflow:hidden; overflow hiding * /
}
The problem of margin external spacing overlap
Phenomenon: by default, two adjacent boxes add margin-top to one box, and after adding margin-bottom to the other box, the two vertical spacing will overlap, showing the spacing of the maximum value.
Solution: A. Add a parent element to the following box and add the declaration overflow:hidden
This is the end of the article on "how to solve the problem of margin-top delivery". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to solve the transmission problem of margin-top". If you want to learn more knowledge, you are welcome to follow the industry information channel.