首页 > 代码库 > 三明治布局

三明治布局

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}

header {
position: absolute;
width: 100%;
height: 60px;
top: 0;
background-color: red;
}

.content {
position: absolute;
width: 100%;
top: 60px;
bottom: 60px;
overflow-y: scroll;
overflow-x: hidden;
}

.blue {
height: 2000px;
background-color: blue;
}

.yellow {
height: 2000px;
background-color: yellow;
}

footer {
position: absolute;
width: 100%;
height: 60px;
bottom: 0;
background-color: red;
}
</style>
</head>

<body>
<header></header>
<div class="content">
<div class="blue"></div>
<div class="yellow"></div>
</div>
<footer></footer>
</body>

</html>

三明治布局