盒子的垂直布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>垂直方向的布局</title>
<style>
.box1{
background-color: silver;
height: 200px;
overflow: visible;
}
.inner{
height:300px;
width: 100px;
background-color: skyblue;
margin-bottom: 20px;
}
</style>
</head>
<body>
<!--
默认情况下,父元素的高度被内容撑开
子元素是在父元素中排列的,如果子元素的大小超过了父元素,则从父元素中溢出
使用overflow设置元素的溢出,设置父元素如何处理溢出的子元素,在父元素中设置
可选值
visible 默认值
hidden 隐藏 溢出的部分被裁剪
scroll 生成滚动条,来查看完整的内容
auto 根据需要生成滚动条
-->
<div class="box1">
<div class="inner"></div>
</div>
</body>
</html>