示例工程 09-display-normal-flow
09-display-normal-flow/demo-02-flow-root/index.html
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>flow-root 与浮动</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>flow-root 与浮动</h1>
<h2>普通父级:高度塌陷</h2>
<div class="parent">
<div class="float">float</div>
</div>
<p class="hint">父级边框只有 padding 高度,浮动溢出。</p>
<h2>flow-root:包住浮动</h2>
<div class="parent flow-root">
<div class="float">float</div>
</div>
<p class="hint">父级高度包含了浮动子元素。</p>
</body>
</html>