[英]Position fixed and Internet Explorer
this is my css. 这是我的CSS。 It is working fine in firefox but not working in IE.
它在Firefox中工作正常,但在IE中无法正常工作。
#Createinner {
position: fixed;
width: 400px;
height: 280px;
margin-left: -200px;
margin-top: -140px;
top: 50%;
left: 50%;
background-color: #ccc;
}
How to solve this. 怎么解决这个问题。
Thanks in advance 提前致谢
只需在页面顶部添加DocType标签即可
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
What sorted my problem with IE was the code in: 用IE排序我的问题是代码:
http://annevankesteren.nl/test/examples/ie/position-fixed.html http://annevankesteren.nl/test/examples/ie/position-fixed.html
basically added: 基本上补充:
h1{
position:fixed;
_position:absolute;
top:0;
_top:expression(eval(document.body.scrollTop));
}
for fixed position in IE 8 DOCTYPE is very very important. 对于IE 8中的固定位置, DOCTYPE非常重要。
one of: 之一:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
or 要么
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
or 要么
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
or 要么
<!DOCTYPE HTML>
And its very very important that 而且非常重要
css: CSS:
#footer
{position: fixed; right: 0px; bottom: 0px; }
html: HTML:
<div id="footer" >
Fixed Div
</div>
IE6 doesn't support position fixed. IE6不支持固定位置。
If you really need this to work in IE6, use conditional comments to serve an IE only CSS file and fake position:fixed
with CSS expressions. 如果您确实需要在IE6中使用它,请使用条件注释来提供仅IE的CSS文件和假
position:fixed
使用CSS表达式position:fixed
。
(edited to correct IE version info.) (编辑以更正IE版本信息。)
I recently wrote a jQuery plugin to get position:fixed working in IE 6+. 我最近写了一个jQuery插件来获取位置:修复了IE 6+的工作。 It doesn't jitter on scroll, it looks at capability (not user-agent), works in Internet Explorer 6, 7, 8.
它不会在滚动上抖动,它会查看功能(不是用户代理),适用于Internet Explorer 6,7,8。
If you use strict mode in IE7+ position:fixed will be honoured, but by default IE7+ operates in Quirks Mode. 如果你在IE7 +位置使用严格模式:固定将被尊重,但默认情况下IE7 +在Quirks模式下运行。 This plugin checks for browser capability, and if it doesn't honour position:fixed, then it implements the jQuery fix.
这个插件检查浏览器功能,如果它不支持position:fixed,那么它实现了jQuery修复。
http://code.google.com/p/fixedposition/ http://code.google.com/p/fixedposition/
Something like this may work for you: 这样的事可能适合你:
$(document).ready(function(){
$("#Createinner").fixedPosition({
debug: true,
fixedTo: "bottom"
});
});
You may need to make some minor CSS adjustments to get it working for your code. 您可能需要进行一些小的CSS调整才能使其适用于您的代码。 I'm working on "offset" values as options as we speak.
我正在研究“偏移”值作为我们所说的选项。
http://ieproblems.blogspot.com/ use this one it will solve your problem http://ieproblems.blogspot.com/使用这个它将解决您的问题
#mainDiv{
overflow:auto;
}
#subDiv{
position:relative;
top:expression(this.offsetParent.scrollTop+'px');
left:expression(this.offsetParent.scrollTop+'px');
}
<html>
<head>
</head>
<body>
<div id="mainDiv">
<div id="subDiv">
This Text is Fixed
</div>
</div>
</body>
</html>
IE 6 does not support position: fixed
IE 6不支持
position: fixed
Other versions of IE don't support position: fixed
in quirks mode 其他版本的IE不支持
position: fixed
在怪异模式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.