html - 带有粘性页脚的 CSS 多个最小高度 : 100% sections,

标签 html css height

我知道有很多问题询问如何制作粘性页脚和 100% 最小高度的主容器。但是我怎样才能拥有多个部分并使每个部分的最小高度达到 100%,同时仍将页脚推到下方?

我有以下内容,这些部分都很好,100%,但页脚没有被压下。

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>test</title>
    <style type="text/css" media="all">
      html, body, .main-container{height:100%;}
      section{min-height: 100%;}
      .footer-container{height: 100px;}
    </style>
  </head>
  <body>
    <div class="header-container">
      <header>
        header
      </header>
    </div>
    <div class="main-container">
      <section>
        section
      </section>
      <section>
        section2
      </section>
      <section>
        section3
      </section>
    </div>
    <div class="footer-container">
      <footer>
        footer
      </footer>
    </div>
  </body>
</html>

对应的jsFiddle:http://jsfiddle.net/S7h8s/

最佳答案

关于html - 带有粘性页脚的 CSS 多个最小高度 : 100% sections,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12060164/

相关文章:

jquery - 将变量传递给 jQuery CSS 值以计算高度

ios - UITableView Cells - 如何使一个单元格的高度固定,其他单元格的高度相对于屏幕尺寸可变?

java - Wicket 口 RepeatingView : delete placeholder if list is empty

html - 如果屏幕太小,我如何在 blogger.com 上构建一个响应式导航栏,它变成一个下拉菜单?

html - 如何防止 <div> 在 Firefox 中 float 在其他 div 之上?

html - vuetify v-text-field 给定值后背景颜色发生变化

html - 表不遵守容器高度

php - 通过 POST 提交时删除某些字符

覆盖html行的Javascript函数

javascript - 边框粘在动态页面上