代码:
#div1 {
min-height:50px;
background-color: #fee;
margin-bottom:-50px;
}
#div2 {
margin-top:50px;
background-color: #efe
}
解释:
- When div1 is hidden, div2 has a top property of 50px
- When div1 is not hidden:
- If div1 height is less than 50px, then div2 is placed at 50px
- If div1 height is more than 50px, then div2 is placed right under div1