CSS方法包括IE6黑客 [英] CSS method to include IE6 hacks

查看:119
本文介绍了CSS方法包括IE6黑客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • CSS有@import,对吗?

  • IE6了解 * html selector

  • CSS has @import, right?
  • IE6 understands *html selector hack, right?

是否可以组合它们

//*html @import url(ie6hacks.css);

或可能

//*html { @import url(ie6hacks.css); }

好的浏览器必须跳过这个,它还会在IE6工作吗?它如何看起来像一个解决方案?

Good browsers must skip this, will it still work in IE6? How does it look as a solution? I can clearly see it looks ugly as normal CSS.

推荐答案


是否可以将它们组合在一起

Is it possible to combine them like



* html @import url(ie6hacks.css);

否。

有些方法可以将规则作为黑客来使用,例如:

There are ways to make at-rules work as hacks, for example this:

@import url(/* no! */iehacks.css);

将由IE6 / 7加载,但不会加载其他浏览器。但是,我不建议使用它;这种事情可能真的很脆弱。这个特殊的例子也是无效的CSS。

will be loaded by IE6/7 but not the other browsers. However, I wouldn't recommend using it; this sort of thing can be really fragile. This particular example is also invalid CSS.

正如丹尼尔所说,如果你想要单独的.css文件hacks,最好的方法是一个条件包含的链接标签。 * html的美妙之处在于,您可以将hack-rules放在同一个样式表中,如果只有少数几个则更容易管理;如果你有一个单独的样式表反正它没有优势。

As Daniel says, if you want separate .css files for hacks, the best approach is a conditionally-included link tag. The beauty of "* html" is that you can put hack-rules in the same stylesheet, which is easier to manage if there are only a few of them; if you're having a separate style sheet anyway, it offers no advantage.

IMO* html为IE6是唯一的黑客它仍然合法使用今天。所有的盒子模型的东西是与IE5一起死亡 - 假设你不使用IE6 Quirks模式,你不应该 - 和其他浏览器,甚至IE7,通常是太好了,无法用一个简单的黑客攻击;可以针对他们的几个黑客太复杂/脆弱/无效,无法真正使用。

IMO "* html" for IE6 is the only hack it's still legitimate to use today. All the box model stuff is dead along with IE5 — assuming you're not using IE6 Quirks Mode, which you shouldn't — and the other browsers, even IE7, are generally too good to be able to attack with a simple hack; the few hacks that can target them are too complex/fragile/invalid to really use.

(作为简化框模型黑客的发明者,我说一个丰盛的好对他们的帮助。)

(And as the inventor of the Simplified Box Model Hack, I say a hearty good riddance to them.)

这篇关于CSS方法包括IE6黑客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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