Ie8 CSS Hack - 最好的方法? [英] Ie8 CSS Hack - best method?

查看:100
本文介绍了Ie8 CSS Hack - 最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以推荐最好的方式通过CSS黑客IE8样式,我最近一直在使IE8渲染为IE7为轻松 - 但想知道是否最好添加IE8黑客?

Can anyone recommend the best way to hack IE8 styling via CSS, I've recently been making IE8 render as IE7 for ease - but wondered if it was best to add IE8 hacks?

推荐答案

你应该扭转你的方法。首先,您的网站在现代浏览器(如Firefox,Chrome,Opera,IE 9)中应该看起来不错,然后就可以开始担心其他人了。

You should reverse your method. First your site should look good in modern browsers (like Firefox, Chrome, Opera, IE 9), and then you can start worrying about the others.

条件注释可以是你的朋友。

As others suggested, conditional comments can be your friend.

首先,你应该开发你的CSS看起来很好在现代浏览器。然后检查IE8,看看你得到了什么问题。如果需要,请包含特定于IE的样式表。之后,您可以签入IE7和IE6,如果您支持它,并添加进一步的修复。

First, you should develop your CSS to look fine in the modern browsers. Then check IE8, see what problems you get. If you need to, include an IE-specific stylesheet. After that, you can check in IE7 and then IE6 if you support it, and add further fixes.

例如:

<link rel="stylesheet" href="normal.css" type="text/css" />
<!--[if lt IE 9]><link rel="stylesheet" type="text/css" href="ie8.css"><![endif]-->
<!--[if lt IE 8]><link rel="stylesheet" type="text/css" href="ie7.css"><![endif]-->

在这种情况下,您包括 normal.css 这是为现代浏览器。你发现了一些奇怪的IE8问题,所以在 ie8.css 你修复的问题。您不必在此包含所有选择器,只有需要修复的选择器(这些值将被覆盖为IE 8和更低版本)。之后,如果在IE7中仍然有一些奇怪的事情,你可以添加你的 ie7.css 并修复这些,等等。

In this case you include normal.css which is for modern browsers. You found some strange IE8 issues, so in ie8.css you fix the problems. You don't have to include all your selectors in this, only the ones that need a fix (the values will be overridden for IE 8 and lower). After that, if there are still some strange things in IE7, you can add your ie7.css and fix those, and so on.

请参阅其他人为您提供的链接,以获取有关条件评论使用的详细信息。

Please refer to the links the others gave you to get more information on the usage of conditional comments.

最后: 使IE8渲染为IE7轻松永远不是一个好主意,应该避免。 IE7是远远的过去(在IT世界里,IE8应该是远远超过...),为现在和未来发展,然后你可以关心仍旧坚持老技术的人(基于您的受众群体和商业计划)。

Finally: making IE8 render as IE7 for ease is never a good idea, and should be avoided. IE7 is the far past (in the IT world, IE8 should be the far past either...), develop for the present and the future, and after that you can care about the people who are still stuck with old technology (based on your audience and business plan).

这篇关于Ie8 CSS Hack - 最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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