填充潜水之间的空间



我有以下HTML:

<body>
  <div class="header">header</div>
  <div class="content">content</div>
  <div class="footer">footer</div>
</body>
CSS:

.header {
  position: absolute;
  top: 0;
  width: 100%;
  height: 80px;
  background-color: #f0f0f0;
}
.content {
  margin: 30px;
  background-color: #bcbcbc;
}
.footer {
   position: absolute;
   bottom: 0;
   width: 100%;
   height: 30px;
   background-color: #f0f0f0;
}

页眉和页脚看起来像我希望的那样,但现在我想让内容填充它们之间的所有空间(周围有30px的边距)。我应该加上什么呢?

谢谢你的帮助

在contentdiv上尝试100%的高度

试试这个

.header, .content, .footer {
    position: absolute;
}
.header{
    top: 0;
    width: 100%;
    height: 50px;
    background-color: #99CC00;
    left: 0;
    right: 0;
}
.content {
    top: 50px;
    left: 0;
    right: 0;
    bottom: 50px;
    background-color: #FF6600;
}
.footer {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 50px;
    background-color: #6600CC;
}

最新更新