第三個盒子沒有出現(xiàn)margin-top重疊問題,請問是修復了嗎?
<!DOCTYPE html>
<html>
?? ?<head>
?? ??? ?<meta charset="utf-8">
?? ??? ?<title></title>
?? ??? ?<style>
?? ??? ??? ?.father1,.father2,.father3{
?? ??? ??? ??? ?float: left;
?? ??? ??? ??? ?margin-right: 10px;
?? ??? ??? ?}
?? ??? ??? ?.son1{
?? ??? ??? ??? ?margin-top: 80px;
?? ??? ??? ??? ?background-color: burlywood;
?? ??? ??? ?}
?? ??? ??? ?.father2{
?? ??? ??? ??? ?margin-top: 80px;
?? ??? ??? ?}
?? ??? ??? ?.son3{
?? ??? ??? ??? ?margin-top: 80px;
?? ??? ??? ?}
?? ??? ??? ?.father3{
?? ??? ??? ??? ?margin-top: 80px;
?? ??? ??? ?}
?? ??? ?</style>
?? ?</head>
?? ?<body>
?? ??? ?<div class="father1">
?? ??? ??? ?<div class="son1">我是son1</div>
?? ??? ?</div>
?? ??? ?<div class="father2">
?? ??? ??? ?<div class="son2">我是son2</div>
?? ??? ?</div>
?? ??? ?<div class="father3">
?? ??? ??? ?<div class="son3">我是son3</div>
?? ??? ?</div>
?? ?</body>
</html>
2017-02-22
????????事實上,你這里的三個元素都沒有發(fā)生margin重疊,你把father1和son2加上margin-top,會發(fā)現(xiàn),他們都沒有重疊了。margin重疊只發(fā)生在普通的block元素上,加上float雖然也會使元素block,但卻不是普通的block元素,應該是脫離文檔流的block元素,視頻前面也說了,float和absolute元素除外。把father1,2,3的float去掉。在每個盒子外面加一個盒子再加上float:left看看吧
2019-05-28
sdfsdfsd
2018-10-26
margin重疊特性第一條就是說:元素為block水平元素(不包括float和absolute元素)
2017-07-09
父級和子級的margin-top都是80px,所以第三個盒子的上外邊距就是80px,這就是重疊了呀
2017-01-13
只有一個margin-top。也不會有重疊呀