<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.container {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: red;
}
</style>
</head>
<body>
<div class="container">
</div>
</body>
</html>
容器相对父元素绝对定位,上下left,right,top,bottom都等于0即可。