簡體   English   中英

動態添加的頁腳不會停留在頁面底部 ASP.NET

[英]Dynamically added footer doesn't stay at the bottom of page ASP.NET

在項目的某個頁面中,我在循環內向表單動態添加面板。 當循環結束時,我動態地添加了一個頁腳,我想把它放在頁面的底部。 使用的代碼和 CSS 類如下:

Form.Controls.Add(new LiteralControl("<div class='form'></ div >" +
                                             "<div class='footer'>  +
                                                    "<p>Copyright © 2019-2020 SiteName.com™. All rights reserved.</p>" +
                                             "</div>"));

   .form {
padding-top: 50px;
position: relative;
z-index: 1;
text-align: center;
min-height: 84vh;

}

 .footer {
font-family: "Roboto", sans-serif;
border: 1px dotted black;
padding: 10px;
bottom: 0;
position: relative;
z-index: 1;
bottom: 0px;

}

我在另一個頁面中對頁腳使用了完全相同的代碼,除了它沒有動態加載,它工作正常,頁腳被放置在頁面底部。 我該怎么做才能通過動態添加頁腳獲得相同的結果?

 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .footer { position: fixed; left: 0; bottom: 0; width: 100%; background-color: red; color: white; text-align: center; } </style> </head> <body> <h2>Fixed/Sticky Footer Example</h2> <p>The footer is placed at the bottom of the page.</p> <div class="footer"> <p>Footer</p> </div> </body> </html>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM