IE 6,7,8,9 CSS兼容性样式表 [英] IE 6,7,8,9 CSS compatibility Stylesheet

查看:93
本文介绍了IE 6,7,8,9 CSS兼容性样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为所有浏览器开发,然后争取IE兼容性是所有网络开发过程中的一个众所周知的步骤。



不是一个网络集成商,你知道任何通用兼容性样式表,很好包括IE(在我的情况下,我只关心IE7,但我会让所有版本的问题打开)

解决方案

normalize.css是一个很好的重置,解决了很多跨浏览器问题。
http://necolas.github.com/normalize.css/ p>

Twitter Bootstrap 适用于预制组件。它是IE兼容的。
如果你决定使用Bootstrap,它的重置实际上是从 normalize.css (因此您不需要同时使用)



HTML5 Boilerplate也可以帮助一些最佳做法标记从头开始:
https://github.com/h5bp/html5-boilerplate



特别是,我建议使用HTML5BP条件注释来定位特定的IE版本,例如:

 <! -  [if lt IE 7]> < html class =no-js lt-ie9 lt-ie8 lt-ie7> <![endif]  - > 
<! - [if IE 7]> < html class =no-js lt-ie9 lt-ie8> <![endif] - >
<! - [if IE 8]> < html class =no-js lt-ie9> <![endif] - >
<! - [if gt IE 8]><! - > < html class =no-js> <! - <![endif] - >

这意味着在你的CSS你可以解决类的IE版本具体问题:

  .lt-ie8 .awesome-component {...} 

最后,我建议AGAINST使用javascript polyfills如CSS3PIE。根据我的经验,他们只是造成更多的麻烦,他们的价值,添加不必要的标记。



了解一些关于优雅退化/渐进增强。



另一个回答提到IE7.js,我相信很好,虽然我不记得它是多么有用。你肯定需要填补缺失的JS函数(如果你使用js)如IE <= 8中的Array.indexOf我刚刚发现这个ECMAScript5垫片看起来不错:
https://github.com/kriskowal/es5-shim


Developping for all browsers, then fighting for IE compatibility is a well know step in all web developement process.

Not being a web integrator, do you know any generic compatibility stylesheet that are good to include for IE ( In my case I'm only concerned about IE7, but I'll let the question open for all version )

解决方案

normalize.css is a good reset that addresses a lot of cross-browser issues. http://necolas.github.com/normalize.css/

Twitter Bootstrap is good if you want pre-made components. It is IE compatible. If you decide to use Bootstrap, its reset is actually adapted from normalize.css (so you won't need both)

HTML5 Boilerplate may also help with some best-practice markup if you're getting started from scratch: https://github.com/h5bp/html5-boilerplate

In particular, I'd recommend using the HTML5BP conditional comments to target specific IE versions, like this:

<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

That means in your CSS you can address IE version specific issues with classes:

.lt-ie8 .awesome-component { ... }

Finally, I would recommend AGAINST using javascript polyfills like CSS3PIE. In my experience they just cause more hassle than they're worth, adding unnecessary markup.

Learn a bit about graceful degradation / progressive enhancement.

Another answer mentioned IE7.js which I believe is fine, though I can't remember how useful it is. You'll definitely need to shim missing JS functions (if you're using js) such as Array.indexOf in IE <= 8. I just found this ECMAScript5 shim which looks pretty good: https://github.com/kriskowal/es5-shim

这篇关于IE 6,7,8,9 CSS兼容性样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆