<style type="text/css">
html,body{height:100%;margin:0;padding:0;}
#bottomDiv{ /*Code for Moz, Opera, etc.*/
height:50px;
width:100%;
background:#9bb;
position:fixed;
bottom:0;
}
#scaleDiv{
position:absolute;
visibility:hidden;
height:100%;
}
</style>
<!--[if IE]>
<style type="text/css"> /*IE-specific markup*/
#bottomDiv{
position:absolute;
top:expression(offsetParent.scrollTop + (document.getElementById("scaleDiv").offsetHeight-50));
}
</style>
<![endif]-->
<div id="scaleDiv">
<!-- this div is to find browser page display height -->
</div>
<div style="font:4em Verdana;padding-bottom:2em;"><!-- bottom padding allows content to clear on scroll -->
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
hello hello
</div>
<div id="bottomDiv">
<p style="text-align: center; color: white">I am here</p>
</div>
本文介绍了一种使用CSS实现底部元素固定显示的方法,并针对不同浏览器提供了兼容性解决方案。通过绝对定位和条件注释,确保了在IE和其他浏览器中底部提示信息能够正确展示。
1万+

被折叠的 条评论
为什么被折叠?



