代碼:<style>? ? body {? ? ? ? width: 300px;? ? ? ? position: relative;? ? }?? ? .aside {? ? ? ? width: 100px;? ? ? ? height: 150px;? ? ? ? float: left;? ? ? ? background: #f66;? ? }?? ? .main {? ? ? ? height: 200px;? ? ? ? background: #fcc;? ? }</style><body>? ? <div class="aside"></div>? ? <div class="main"></div></body>然后某些資料看的:哪些元素會生成BFC?根元素float屬性不為noneposition為absolute或fixeddisplay為inline-block, table-cell, table-caption, flex, inline-flexoverflow不為visible其中第2點(diǎn) ?float屬性不為none ? 就可以生成BFC,代碼中的aside 是不是 就是一個(gè)BFC ??我看資料 都是在.main {? ? overflow: hidden;}添加overflow 來 生成BFC。
有關(guān)BFC生成的問題。
qq_ggJKING_LWJ_0
2016-08-25 21:21:01