【问题标题】:css sticky footer in an asp.net pageasp.net页面中的css粘性页脚
【发布时间】:2011-05-06 02:33:40
【问题描述】:

我正在尝试创建一个贴在页面底部的页脚。我有:

<body>
    <form id="form1" runat="server">
    <div id="wrap">
        <div id="content">
            <uc2:logo ID="logo1" runat="server" />
        </div>
    </div>
    <uc1:footer ID="footer1" runat="server" />
    </form>
</body>

这是我的css

body {
    margin: 30px 10px 0px 10px;
    font-size: 14px;
    font: 76% Arial,Verdana,Helvetica,sans-serif;
}
html, body, form, #wrap { height: 100%; }
form > #wrap { height: auto; min-height: 100%; }

#wrap {
    width: 1000px;
    margin: auto;

}

#content {

    text-align:left;

}


#footer {
 clear: both;
 position: relative;
 z-index: 10;
 width:1000px;
 margin:auto;
}

我错过了什么?页脚出现在视口下方(滚动条也在页面上)。我预计这会是某种保证金问题。

【问题讨论】:

    标签: asp.net html css


    【解决方案1】:

    【讨论】:

    • 必须将表单元素添加到关于 body 和 html 元素的 css 规则中,然后它才起作用。
    【解决方案2】:

    尝试绝对位置:

    #footer {
     clear: both;
     position: absolute;
     z-index: 10;
     width:1000px;
     margin:auto;
     bottom:0px;
     height:50px;
    }
    

    【讨论】:

    • 是的 - 位置:绝对;也在解决方案中。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2011-08-14
    • 2012-05-14
    • 2015-02-11
    • 2016-05-01
    • 2016-12-22
    • 2013-02-23
    • 2014-03-15
    相关资源
    最近更新 更多