精通css(7)-實例

1.讓footerr固定在底部

來源於http://ryanfait.com/resources/footer-stick-to-bottom-of-page/一種很簡單的方法:

<body>
<div class="wrapper">
    <p>Your website content here.</p>
    <div class="push"></div>
</div>
<div class="footer">
    <p>Copyright (c) 2008</p>
</div>
</body>

<style>
  * {
   margin: 0;
  }
   html, body {
   height: 100%;
  }
   .wrapper {
   min-height: 100%;
   height: auto !important;
   height: 100%;
   margin: 0 auto -4em;
  }
   .footer, .push {
   height: 4em;
  }
  .footer{
    background: #400;
  }

</style>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章