如何获取母版页上的“页脚”内容推下来的时候主要内容不填充页面 [英] How do I get ‘footer’ content on a master page to push down when main content doesn't fill a page

查看:89
本文介绍了如何获取母版页上的“页脚”内容推下来的时候主要内容不填充页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code为我的母版:

I have the following code for my masterpage:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server" style="position:relative">
    <title>Masterpage</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="main" runat="server" style="position:relative">
    <div>
        <asp:ContentPlaceHolder id="MainContent" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
    <br style="clear:both" />
    <form id="footer" style="position:relative">
    <div>
        <center style="font-size:small">Footer content</center>
    </div>    
    </form>
</body>
</html>

我的问题是,当日程地址搜索Maincontent未填充的页面页脚不是在页面的底部。有没有办法强制页脚留在页面的底部,如果主要内容是不是推动它一路下滑?当主要内容是大足够它滚动下来的时候推动页脚下来的内容和显示在底部,但如果是小。

My problem is that when the MainContent isn't filling up the page the footer is not at the bottom of the page. Is there a way to force the footer to stay on the bottom of the page if the main content isn't pushing it all the way down? When the main content is "big" enough it pushes the footer down with the content and displays on the bottom when scrolling down, but not if it is to small.

有人知道如何解决这一问题?

Anybody know how to fix this?

推荐答案

使用下面的在你的CSS页脚DIV:

Use the following in your css for the footer div:

bottom:0px;
position:absolute;

这篇关于如何获取母版页上的“页脚”内容推下来的时候主要内容不填充页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆