2012-12-10 22 views
0

我有這個頁面,我有一個頁腳,頁面也顯示一個Gridview,Gridview的內容取決於用戶選擇的內容,Gridview可能從無到有,到168行,並介於兩者之間。頁腳div不會停留在展開GridView時

的母版頁是這樣的:

<html> 
<body> 
    STUFF 
    <div id="footer"> 
    <p>This is the footer</p> 
    </div> 
</body> 
</html> 

的CSS是這樣的:

#footer { 
width: 100%; 
height: 60px; 
margin: 0 auto; 
padding: 0; 
background: #E1E1E1; 
position:absolute; 
bottom:0; 
} 

現在,我已經嘗試過的位置是:固定的,但它不是我想要的東西,這樣的頁腳在頁面內容上顯示,我希望它位於頁面底部。如果我將它設置爲相對,它會設置爲母版頁的內容佔位符的頂點,但您仍然可以在Gridviews後面看到它,如果將其設置爲絕對,它會到達底部,但它只在Gridview具有一定的小尺寸行,如果它必須顯示許多行,頁腳也會出現在gridviews之後。

這讓我瘋狂。感謝您的任何建議。

+0

你爲什麼不使用'

'來組織你的頁面內容? – jjj

+0

你在'' – jjj

+0

這是一個錯字,我只是爲了顯示頁腳的位置而編寫了代碼。 – user1676874

回答

1

試試這個: Sticky Footer

* { 
    margin: 0; 
} 
html, body { 
    height: 100%; 
} 
.wrapper { 
    min-height: 100%; 
    height: auto !important; 
    height: 100%; 
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */ 
} 
.footer, .push { 
    height: 142px; /* .push must be the same height as .footer */ 
} 

/* 

Sticky Footer by Ryan Fait 
http://ryanfait.com/ 

*/