简体   繁体   English

IE浏览器CSS IE6,IE7,IE8和IE9之间的差异

[英]IE Explorer CSS Discrepancy Between IE6, IE7, IE8 & IE9

No version of IE is displaying my css template the same. 没有版本的IE显示我的css模板相同。 Does anyone know what the causes of the differences are? 有谁知道差异的原因是什么?

Currently the site works perfectly in Chrome, Firefox and Safari so now comes IE testing (the bane of my life, and surprise surprise it's not working but it has be stumped). 目前该网站在Chrome,Firefox和Safari中运行良好,因此现在进行了IE测试(我生命中的祸根,令人惊讶的是它不起作用,但它已被难倒)。

Can anyone explain what is causing the problems? 任何人都可以解释导致问题的原因吗? Things I have noticed: background missing in IE9, gaps around background in IE7, page simply not there IE6, margins wrong IE* 我注意到的事情:IE9背景缺失,IE7背景空白,页面根本没有IE6,边缘错误IE *

Dead link 死链接


Some browser shots: http://browsershots.org/http://beta.pegproductions.com/urlshortener/template.html 一些浏览器镜头: http//browsershots.org/http : //beta.pegproductions.com/urlshortener/template.html


Update, after following advice IE7, 8 & 9 still have trouble displaying the background, does anyone know why? 更新后,按照以下建议IE7,8&9仍然无法显示背景,有谁知道为什么?

"Does anyone know what the causes of the differences are?" “有谁知道差异的原因是什么?”

The cause is that MS is a gigantic corporation with an immense installed user base. 原因是MS是一个巨大的公司,拥有庞大的用户群。 MS also has tightly intertwined enterprise software offerings and has made IE a part of that tangled mess. MS还拥有紧密交织的企业软件产品,并使IE成为纠结混乱的一部分。 As such, the incentive to release fully W3C compliant browser engines isn't there, and as IE isn't a direct money maker for them, that just compounds the issue. 因此,发布完全符合W3C标准的浏览器引擎的动机并不存在,并且因为IE不是他们的直接赚钱机器,这只会使问题更加复杂化。

"Can anyone explain what is causing the problems? " “任何人都可以解释造成这些问题的原因吗?”

Not in one answer. 不是一个答案。 The bugs are immense and vary from version to version. 这些错误是巨大的,因版本而异。 IE9 is pretty close to being standard. IE9非常接近标准。 IE8 is acceptable. IE8是可以接受的。 IE7 is a pain and IE6 will just cause you to swear and throw things. IE7是一种痛苦,IE6只会让你发誓扔东西。

Fortunately, someone at MS knew this was an issue and managed to get conditional comments implemented in IE that lets you target specific content for specific versions of IE. 幸运的是,MS的某个人知道这是一个问题,并设法在IE中实现条件性评论,让您针对特定版本的IE定位特定内容。 A gigantic hack, for sure, but thankfully we at least have that. 一个巨大的黑客,当然,但幸运的是我们至少有这个。 This is a good method that lots of people use: 这是很多人使用的好方法:

http://www.positioniseverything.net/articles/cc-plus.html http://www.positioniseverything.net/articles/cc-plus.html

You shouldn't really be using spans for your layout. 你不应该真正使用跨度来进行布局。

Use divs or at least set display: block; 使用div或至少设置display: block; on your spans. 在你的跨度。

That should hopefully fix SOME of your issues, good luck with the rest. 这应该有希望解决你的一些问题,其余的好运。

You may have updated the code since Marko's answer because I don't see any spans. 您可能已经更新了Marko的答案后的代码,因为我没有看到任何跨度。 That said, you still have a ton of code to accomplish a pretty basic layout (box with rounded corners and a gradient). 也就是说,你仍然需要大量的代码来完成一个非常基本的布局(带有圆角和渐变的框)。

You may want to simplify what you're doing by using a single <div> for your content, then using CSS rounded corners to cover most browsers, then, if you really want to make the look identical in IE, use one of the various methods to round corners for IE ( here's a good choice ). 您可能希望通过使用单个<div>作为内容来简化您正在做的事情,然后使用CSS圆角覆盖大多数浏览器,然后,如果您真的想在IE中使外观相同,请使用其中一种IE的圆角方法( 这是一个不错的选择 )。

This should also allow you to use the gradient background if you wish with less discrepancies between browsers. 如果您希望浏览器之间的差异较小,这也应该允许您使用渐变背景。 Here's a quick example without any background image. 这是一个没有任何背景图像的快速示例

Try not to reinvent the wheel, many people have gone through all the pain already getting certain designs, frameworks and widgets working cross-browser. 尽量不要重新发明轮子,许多人已经经历了所有的痛苦已经让某些设计,框架和小部件跨浏览器工作。 Use or base your design on something tried and tested, complying to licensing of course. 在经过试验和测试的东西上使用或建立您的设计,当然要遵守许可。 Is your design really that unique/good that it's worth the hassle of making from scratch? 你的设计真的那么独特/好,值得从头开始制作的麻烦吗?

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

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