示例工程 10-sizing-overflow
10-sizing-overflow/demo-02-overflow/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>overflow 四值</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>overflow 四值</h1>
<p>每个盒子固定 220×90,内容比盒子长。</p>
<div class="grid">
<div class="box visible"><strong>visible</strong><p>这段文字会溢出盒子,可能压到其它内容上。</p></div>
<div class="box hidden"><strong>hidden</strong><p>这段文字会被裁掉,看不到溢出部分。</p></div>
<div class="box auto"><strong>auto</strong><p>这段文字需要时出现滚动条,可以读全。</p></div>
<div class="box scroll"><strong>scroll</strong><p>这段文字总是显示滚动条,即使内容不够长。</p></div>
</div>
</body>
</html>