1. 首页
  2. 大数据
  3. Storm
  4. CSS中如何解决外边距塌陷问题

CSS中如何解决外边距塌陷问题

上传者: 2020-11-22 04:39:55上传 PDF文件 39KB 热度 40次
首先我们先看出现外边距塌陷的三种情况: 1.当上下相邻的两个块级元素相遇,上面的元素有下边距margin-bottom,下面的元素有上边距margin-top,则它们之间的垂直距离取两个值中的较大者。 <style> .box1 { width: 150px; height: 100px; margin-bottom: 20px; background-color: rgb(201, 239, 98); } .box2 { width: 100px; height: 100px; backgroun
用户评论