- 要点:
- 父元素高度固定、且相对定义
- 子元素采用绝对定位 ,且bottom为0
<!DOCTYPE html>
<html>
<head>
<title>Listening to DOM events</title>
<style type="text/css">
.box1 {
border: 1px #cccccc solid;
width: 500px;
height: 600px;
position: absolute;
}
.box2 {
border-top: 1px #cccccc solid;
width: 100%;
height: 70px;
position: absolute;
background-color: green;
bottom: 0;
}
</style>
</head>
<body>
<div class="box1" style="border: 1px solid red;">
<div class="box2" style="border: 1px solid blue;"></div>
</div>
</body>
</html>