小编典典

如何在IE 6中将浮动页脚粘贴到视口的底部?

css

我知道position:fixed会很容易,但是不幸的是,我坚持支持IE6。如何做到这一点?我宁愿使用CSS进行清理,但是如果我必须使用Javascript,那还不是世界末日。在我当前的实现中,我有一个“浮动页脚”,它浮动在主要内容区域上方,并使用Javascript定位。我现在拥有的实现即使使用Java脚本也不是特别优雅,所以我的问题是:

  1. 没有Java,有没有办法做到这一点?
  2. 如果必须使用Javascript,是否有解决此浮动页脚问题的“不错”的解决方案?“好”是指可以在浏览器中使用的东西,不会过载浏览器的资源(因为它必须经常重新计算),并且优雅/易于使用(例如,编写类似的东西会很好new FloatingFooter("floatingDiv"))。

我猜想没有一个超级简单的解决方案可以满足以上所有需求,但是我可以借鉴的东西会很棒。

最后,只是一个更普遍的问题。我知道这个问题很难解决,那么还有什么其他UI替代方法,而不是在每个页面的底部都有页脚内容?在我的特定站点上,我用它来显示步骤之间的转换。还有其他方法可以做到这一点吗?


阅读 369

收藏
2020-05-16

共1个答案

小编典典

这可能对您有用。我可以在IE6和Firefox 2.0.0.17上运行。试一试。为了达到效果,我使页脚的高度很高。您显然会根据需要进行更改。希望这对您有用。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Liquid Footer</title>
    <style type="text/css">
    .footer {
background-color: #cdcdcd;
height: 180px;
text-align: center;
font-size:10px;
color:#CC0000;
font-family:Verdana;
padding-top: 10px;
width: 100%;
position:fixed;
left: 0px;
bottom: 0px;
}
    </style>
    <!--[if lte IE 6]>
    <style type="text/css">
    body {height:100%; overflow-y:auto;}
    html {overflow-x:auto; overflow-y:hidden;}
    * html .footer {position:absolute;}
    </style>
    <![endif]-->
</head>

<body>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   This is to expand the content on the page<br>
   <div class="footer">-- This is your liquid footer --</div>
</body>
</html>
2020-05-16