[js]css处理浮动后父元素的高度

来源:互联网 发布:linux arp命令 编辑:程序博客网 时间:2024/05/01 16:15

css处理内容自动撑高父元素的高度:

overflow: hidden;

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title>    <style>        .content{            border: 1px solid black;            overflow: hidden;        }        .box1{            float: left;            width: 100px;            height: 100px;            background-color: blue;        }        .box2{            float: left;            width: 100px;            height: 200px;            background-color: yellow;        }        .box3{            float: left;            width: 100px;            height: 300px;            background-color: green;        }    </style></head><body>    <div class="content">        <div class="box1"></div>        <div class="box2"></div>        <div class="box3"></div>    </div></body></html>


阅读全文
0 0