简体   繁体   English

布局在IE 7中完全搞砸了

[英]Layout totally messed up in IE 7

My page works fine in all the browsers except IE 7. In IE7, the divs get go out of their place completely. 我的页面在除IE 7之外的所有浏览器中都能正常工作。在IE7中,div完全脱离了它们的位置。 I suspect its due to the usage of position:fixed . 我怀疑它是由于使用position:fixed I tried using the proper doctype as many suggested and it still doesn't help. 我尝试使用正确的doctype ,但它仍然无济于事。 Also IE7 says its rendering in standard mode so I don't know what the issue is. IE7也说它在标准模式下渲染,所以我不知道问题是什么。 Here's the jsfiddle link: http://jsfiddle.net/FgXS4/ 这是jsfiddle链接: http//jsfiddle.net/FgXS4/

IE7 has known serious issues with position:fixed . IE7已知道position:fixed严重问题position:fixed

If you need to support IE7, your best option would be to just forget about the fixed positioning thing for that browser, and let the element scroll with the rest of the page. 如果你需要支持IE7,你最好的选择是忘记该浏览器的固定定位事物,并让元素滚动到页面的其余部分。 Write a custom stylesheet that only kicks in for IE7 which overrides the standard CSS, and let IE7 users have a slightly degraded browsing experience. 编写一个自定义样式表,只针对IE7推出标准CSS,并让IE7用户略微降低浏览体验。 That's my advice for your best option. 这是我对你最佳选择的建议。

There are hacks around that try to fix the problem, notably IE9.js , which implements a whole load of patches into old IE versions to try to get them to comply with modern standards. 有一些黑客试图解决这个问题,特别是IE9.js ,它在旧的IE版本中实现了一大堆补丁,试图让它们符合现代标准。 It's a great little script. 这是一个很棒的小脚本。 It can't do everything, and it certainly doesn't magically turn IE7 into IE9, but it might help with this issue (I know it has got patches in it that specifically deal with IE7's position:fixed bugs), so it might be worth giving it a go. 它不能做任何事情,它肯定不会神奇地将IE7变成IE9,但它可能有助于解决这个问题(我知道它有专门处理IE7的position:fixed修补程序position:fixed错误),所以它可能是值得一试。

Your other option, of course, is to stop supporting IE7. 当然,您的另一个选择是停止支持IE7。 In all honesty, this might be a good answer. 老实说,这可能是一个很好的答案。 The number of people using IE7 is dropping very quickly (faster even than IE6); 使用IE7的人数下降非常快(甚至比IE6更快); the usage figures for it a extremely low and getting lower every month. 它的使用数据极低,每个月都在降低。 You might find yourself doing a lot of work to fix this, and then having virtually nobody that actually benefits from it. 您可能会发现自己正在做很多工作来解决这个问题,然后几乎没有人真正从中获益。 You could save yourself a lot of time if you just drop support for IE7 altogether. 如果你完全放弃对IE7的支持,你可以节省很多时间。 If you're lucky, maybe no-one will even notice. 如果你很幸运,也许没有人会注意到。 (and even if they do notice, maybe it'll give them a nudge that they need to upgrade their browser!) (即使他们确实注意到,也许它会给他们一个轻推他们需要升级他们的浏览器!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM