为了账号安全,请及时绑定邮箱和手机立即绑定

css 设置浮动或者定位脱离文档流问题

css 设置浮动或者定位脱离文档流问题

css 设置浮动或者定位脱离文档流问题之后 父元素DIV 高度就会变为0; 如果你不设置高度的话 下面就会挤上来。如何不设置高度让子元素撑开高度呢。下面的代码就是、  底部DIV 清除浮动不会挤上来了, 但是设置margin-top 无用<!doctype html><html><head>    <meta charset="utf-8">    <title></title>    <style>    .header ul li {    width: 30%;    height: 50px;    background: #ccc;    float: left;    margin: 10px 10px;    }    .footer {    height: 30px;    background: red;    clear: left;    margin-top: 100px;  /* 没用 */    }    </style></head><body><div class="header"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul></div><div class="footer"> </div></body></html>如何不设置高度让子元素撑开高度呢。
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 2786 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信