我试图得到一个内容div来基本上在我的标题和我的脚之间运行页面的整个高度.如果我使用:
#content{ height: 100%; }
Run Code Online (Sandbox Code Playgroud)
它只会与div中的内容一样高.有时我可能只有一个句子但是想要div(带背景或边框)来运行屏幕的长度,直到只有75px高大的页脚.
有没有办法用CSS轻松做到这一点?目前我所拥有的是:
<style>
#content {
margin-top: 0px;
height: 800px;
width: 800px;
margin-left: auto;
margin-right: auto;
background-color: #E0E0E0 ;
}
</style>
</head>
<body>
<div id="content">
this is a div! with some centered crap
</div>
Run Code Online (Sandbox Code Playgroud)