<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.container {
height: 200px;
background: gray;
position: relative;
top: 100px;
}
.title {
background: green;
height: 50px;
color: #fff;
position: relative;
top: -20px;
width: 200px;
margin: auto;
text-align: center;
}
.content {
background: blue;
position: absolute;
left: 50px;
right: 50px;
top: 50px;
bottom: 0;
color: #fff;
overflow-y: auto;
}
</style>
</head>
<body>
<div class='container'>
<div class="title">title</div>
<div class="content">
<div style="height: 1000px">
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
<span>awawegaweg</span>
</div>
</div>
</div>
</body>
</html>
子元素铺满父元素剩余空间,并且自动出现滚动条
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 在很多高度不固定的网页中,当内容高度足够用一屏进行展示时,不会出现滚动条,而当内容高度高于一屏时,浏览器右侧就会出...
- 本人对前端算不得精通,只能说熟悉,在公司项目中遇见各种问题,在此文集中进行记录。 首先介绍下此次问题产生的原...
- 最近写的一个页面中遇到一个多级的树形结构,使用el-tree组件后,父容器规定了宽高,设置overflow:aut...