<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<style>
html,body{height: 100%;padding: 0;margin: 0;}
.auto { height: 100%; position: relative; }
.A { height: 100px; background: #BBE8F2; }
.b { background: #D9C666; width: 100%; position: absolute; top: 100px ; left: 0 ; bottom: 0; }
</style>
<body>
<div class="auto">
<div class="A"></div>
<div class="b"></div>
</div>
</body>
</html>
最终效果

本文介绍了一种利用HTML和CSS实现特殊网页布局的方法。通过绝对定位和相对定位结合的方式,实现了顶部固定高度区域与底部自适应高度区域的无缝衔接。此布局方案适用于需要固定头部而主体内容高度不定的页面设计。
512

被折叠的 条评论
为什么被折叠?



