如何保持低于内容和粘性

时间:2017-09-19 03:12:20

标签: html css footer

我正在使用下面的代码。
当我打开网站时, 页脚覆盖固定底部不在内容下方的主体内容。 我需要帮助两件事。
1)当Ctrl +( - )缩小时,页脚应固定(粘性)底侧
2)当Ctrl +(+)放大时,页脚应浮动在主体内容上
我不确定我的解释是否被告知 你能帮忙,如何解决这个问题?
感谢。

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="container">

        <div id="header"> <?php     include 'header.php';   ?> </div>

        <div id="body"><div class="container0">     </div></div>

        <div id="footer"><?php  include 'footer.php';   ?></div>
</div>
</body>
</html>
body {
      margin:0;
      padding:0;
      height:100%;
}

#container {
      min-height:100%;
      position:relative;
}

#body{
      padding:10px;
      padding-bottom:231px;
}

#footer {
      width: 100%;
      height: 231px;
      position: absolute;
      bottom: 0;
      clear:both;
}

1 个答案:

答案 0 :(得分:0)

添加此

autoptimize_...js