-
关于CSS在浏览器中固定定位position:fixed的应用
日期:2009-06-23 | 分类:互联网
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://ericneo.blogbus.com/logs/41394849.html
对于样式position:fixed,IE7及大多数浏览器都有用,而对于IE6及以下版本,并不能应用!
对于页面固定标签<div id="top">
<a href="#top11" title="回到页眉">回到页眉</a></div>的应用。
IE7及其他浏览起可以这样设置样式:
<style type="text/css">
#top{position:fixed; bottom:0;right:0;height:34px;width:34px;}
#top a{display:block;height:35px;width:35px;text-indent:-9999px;background:url([url]http://dancewithnet.com/wp-content/themes/dancewithnet/img/symbols.png[/url]) no-repeat 0 -600px;}
#top a:hover{border:none;background:url([url]http://dancewithnet.com/wp-content/themes/dancewithnet/img/symbols.png[/url]) no-repeat 0 -635px;}
</style>
而对于IE6浏览器的兼容需要加上声明:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
及样式:
<style type="text/css">
html{overflow:hidden;}
body{height:100%;overflow:auto;}
#top{position:absolute;right:17px;}
</style>
这样就是实现绝大部分浏览器兼容(不包括IE5以下)本文出自 “开拓世界领先的WEB技术” 博客
随机文章:
【IE6 BUG大全】position:fixed在IE6下的实现 2009-06-30兼容火狐和IE的加入收藏夹/设为首页代码 2009-11-12绝对定位和相对定位 2009-05-30转:如何去除横向滚动条 2009-05-13DW快捷键 2009-04-22
收藏到:Del.icio.us







