嗨,我想在我的身体中间放一个 div。此 div 的最小高度为 400 像素,但此 div 的大小可能会随着内容的增加而增加。当我向这个 div 添加更多内容时,它会变得很好,但它也开始触及 div 的底部。
我想在 div 和底部之间有一个最小的空间,这样如果 div 的大小增加,至少在 body 和 div 之间保留了很多空间。
我的 HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TODO-List</title>
<link rel="stylesheet" href="StyleSheet.css">
</head>
<body>
<div class="container">
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
This is sample content<br />
</div>
</body>
</html>
我的 CSS
.container
{
/*display*/
margin: 0px;
padding: 0px;
min-height: 400px;
width: 40%;
/*Border*/
border: 2px solid Grey;
border-radius: 5px;
box-shadow: 0px 0px 2px 2px Grey;
-moz-box-shadow: 0px 0px 2px 2px Grey;
-webkit-box-shadow: 0px 0px 2px 2px Grey;
/*Position*/
position: absolute;
left: 30%;
top: 270px;
}