2016-02-27 85 views
0

我有一個粘滯的頁腳,需要在網站內容增長時重新定位。目前,當我的textarea增長到某個特定點時,它只是下流頁腳,而頁腳仍然保持原樣。響應調整大小

響應高度調整元素的最佳方法是什麼?我看過一些使用動畫幀等的東西。但是我想要做的就是每次調整大小事件時重新計算頁腳的位置。

+0

[**我沒有做2個回答一個棘手的頁腳問題昨日**](http://stackoverflow.com/questions/35627806/ css-sticky-footer-with-full-height-content-divs)也許它們對你來說可能是有用的。 –

回答

2

瑞安既成事實的sticky footer

* { 
 
    margin: 0; 
 
} 
 

 
html, 
 
body { 
 
    height: 100%; 
 
} 
 

 
main { 
 
    min-height: 100%; 
 
    height: auto !important; 
 
    /* This line and the next line are not necessary unless you need IE6 support */ 
 
    height: 100%; 
 
    margin: 0 auto -155px; 
 
    /* the bottom margin is the negative value of the footer's height */ 
 
} 
 

 
footer, 
 
.push { 
 
    height: 155px; 
 
    /* .push must be the same height as .footer */ 
 
} 
 

 
footer { 
 
    height; 
 
    155px; 
 
    background: gray; 
 
} 
 

 
textarea { 
 
    height: 100px; 
 
    width: 200px; 
 
}
<main> 
 
    <textarea></textarea> 
 
    <div class="push"></div> 
 
</main> 
 
<footer> 
 

 
</footer>