1. 主页
  2. 文档
  3. CSS
  4. CSS3浮动定位与背景样式
  5. BFC

BFC

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 400px;
            border: 10px solid #000;
            overflow: hidden;
        }
        .box .c1{
            width: 200px;
            height: 200px;
            background-color: orange;
            float: left;
        }
        .box .c2{
            width: 200px;
            height: 200px;
            background-color: blue;
            float: left;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="c1"></div>
        <div class="c2"></div>
    </div>
</body>
</html>
这篇文章对您有用吗?

我们要如何帮助您?