ie6 ie7 ie8 ff兼容fixed的写法?_html/css_WEB-ITnose
ie6 ie7 ie8 ff兼容fixed的写法?
回复讨论(解决方案)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title>IE6 position:fixed</title><style type="text/css">* { margin:0; padding:0;}#content{ height:2000px; }#a{ position:fixed; bottom:0; right:0; width:200px; height:60px; background:#F00;}/*IE6 fixed bug*/* html{overflow:hidden;}* html body{height:100%;overflow:auto;}* html #a{position:absolute;right:18px;}</style></head><body><div id="content">IE6 position:fixed</div><div id="a">IE6 position:fixed</div></body></html>
或
<!DOCTYPE HTML><html> <head> <meta charset="gb2312" /> <title></title> <style> body { height:1200px; } .floatDIV { width:100px; height:100px; background:#ddd; top:100px; right:10px; /* not ie6 */ position:fixed; /* ie6 */ _position:absolute; _top:expression(documentElement.scrollTop + 100); } html { _background:url(about:blank); /* 阻止闪动 in IE6,把空文件换成about:blank,减少请求 */ } </style> </head> <body> <div class="floatDIV"> 123 </div> </body></html>
兼容IE6/IE7/IE8/IE9/Firefox/Chrome/Safari/Oprea浏览器的浮动代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css">html,body{margin:0;padding:0;}#y1 {position:fixed;top:0;left:0;width:100px;height:100px;border:1px solid red;}#y2 {position:fixed;top:0;right:0;width:100px;height:100px;border:1px solid red;}#y3 {position:fixed;bottom:0;left:0;width:100px;height:100px;border:1px solid red;}#y4 {position:fixed;bottom:0;right:0;width:100px;height:100px;border:1px solid red;}</style><!--[if lte IE 6]><style>#y1 {position:absolute;}#y2 {position:absolute;}#y3 {position:absolute;}#y4 {position:absolute;}</style><![endif]--> <script type="text/javascript"> //以下所有脚本只为IE6写,其他浏览器完全可以删除。 function getViewportScrollX() { var scrollX = 0; if (document.documentElement && document.documentElement.scrollLeft) { scrollX = document.documentElement.scrollLeft; } else if (document.body && document.body.scrollLeft) { scrollX = document.body.scrollLeft; } else if (window.pageXOffset) { scrollX = window.pageXOffset; } else if (window.scrollX) { scrollX = window.scrollX; } return scrollX; } function getViewportScrollY() { var scrollY = 0; if (document.documentElement && document.documentElement.scrollTop) { scrollY = document.documentElement.scrollTop; } else if (document.body && document.body.scrollTop) { scrollY = document.body.scrollTop; } else if (window.pageYOffset) { scrollY = window.pageYOffset; } else if (window.scrollY) { scrollY = window.scrollY; } return scrollY; } function getViewportWidth() { var width = 0; if (document.documentElement && document.documentElement.clientWidth) { width = document.documentElement.clientWidth; } else if (document.body && document.body.clientWidth) { width = document.body.clientWidth; } else if (window.innerWidth) { width = window.innerWidth - 18; } return width; } function getViewportHeight() { var height = 0; if (window.innerHeight) { height = window.innerHeight - 18; } else if (document.documentElement && document.documentElement.clientHeight) { height = document.documentElement.clientHeight; } else if (document.body && document.body.clientHeight) { height = document.body.clientHeight; } return height; } if (navigator.userAgent.indexOf("MSIE 6") > -1 && navigator.userAgent.indexOf("MSIE 7") == -1 && navigator.userAgent.indexOf("MSIE 8") == -1) { window.ononload = window.onscroll = window.onresize = function (e) { var t = getViewportScrollY(); var l = getViewportScrollX(); var w = getViewportWidth(); var h = getViewportHeight(); document.getElementById("y1").style.left = l + "px"; document.getElementById("y1").style.top = t + "px"; document.getElementById("y2").style.left = l + w - document.getElementById("y2").offsetWidth + "px"; document.getElementById("y2").style.top = t + "px"; document.getElementById("y3").style.left = l + "px"; document.getElementById("y3").style.top = t + h - document.getElementById("y2").offsetHeight + "px"; document.getElementById("y4").style.left = l + w - document.getElementById("y2").offsetWidth + "px"; document.getElementById("y4").style.top = t + h - document.getElementById("y2").offsetHeight + "px"; } }</script></head><body><div id="y1">左上角位置的内容</div><div id="y2">右上角位置的内容</div><div id="y3">左下角位置的内容</div><div id="y4">右下角位置的内容</div><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p></body></html>
http://www.9958.pw/post/css_position_fixed 亲测通过

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

公众号网页更新缓存,这玩意儿,说简单也简单,说复杂也够你喝一壶的。你辛辛苦苦更新了公众号文章,结果用户打开还是老版本,这滋味,谁受得了?这篇文章,咱就来扒一扒这背后的弯弯绕绕,以及如何优雅地解决这个问题。读完之后,你就能轻松应对各种缓存难题,让你的用户始终体验到最新鲜的内容。先说点基础的。网页缓存,说白了就是浏览器或者服务器为了提高访问速度,把一些静态资源(比如图片、CSS、JS)或者页面内容存储起来。下次访问时,直接从缓存里取,不用再重新下载,速度自然快。但这玩意儿,也是个双刃剑。新版本上线,

本文讨论了使用HTML5表单验证属性,例如必需的,图案,最小,最大和长度限制,以直接在浏览器中验证用户输入。

本文展示了使用CSS为网页中添加有效的PNG边框。 它认为,与JavaScript或库相比,CSS提供了出色的性能,详细介绍了如何调整边界宽度,样式和颜色以获得微妙或突出的效果

本文讨论了html&lt; datalist&gt;元素,通过提供自动完整建议,改善用户体验并减少错误来增强表格。Character计数:159

本文讨论了HTML&lt; Progress&gt;元素,其目的,样式和与&lt; meter&gt;元素。主要重点是使用&lt; progress&gt;为了完成任务和LT;仪表&gt;对于stati

本文解释了HTML5&lt; time&gt;语义日期/时间表示的元素。 它强调了DateTime属性对机器可读性(ISO 8601格式)的重要性,并在人类可读文本旁边,增强Accessibilit

本文讨论了HTML&lt; meter&gt;元素,用于在一个范围内显示标量或分数值及其在Web开发中的常见应用。它区分了&lt; meter&gt;从&lt; progress&gt;和前
