CSS 怎么写 只有IE8能识别?

2011 年 12 月 20 日
 Eysa
就IE8 最邪恶!
6060 次点击
所在节点    问与答
15 条回复
acgism
2011 年 12 月 20 日
<!--[if IE 8]>
<link rel="stylesheet" href="" type="text/css" media="screen" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" href="" type="text/css" media="screen" />
underone
2011 年 12 月 20 日
这个。。如果不用if的话。。。
后缀“\9”应该是让8以下的IE全部识别吧(还是9以下的)
然后再用_和+做前缀分别识别6和7...8就出来了...
当然这是笨办法...

比如
span.v2ex {
font-size:12px;
font-size:14px\9;
+font-size:16px;
_font-size:18px;
}

不知道是不是可以啊...记得不太清楚了...
Eysa
2011 年 12 月 20 日
这个。。。 能否在 CSS 里写个什么的。还要外链?
Eysa
2011 年 12 月 20 日
<fieldset>
<legend align="right" style="">
<h4 style=" font-size:30px;">这是一个标题</h4></legend>
<div class="hack" style="margin-top: 20px; background-color:yellow;">
万恶的IE8</div>
<div style="margin-top: 20px; background-color:Red;">
万恶的IE8</div>
<p>
<input type="submit" value="注册" />
</p>
</fieldset>



求 hack
acgism
2011 年 12 月 20 日
@Eysa 或者直接放弃IE 识别到IE内核的浏览器就直接跳转到这样的一个页面http://acgism.com/Just_say_no_to_IE/ (抽打,拖走。。。。
Eysa
2011 年 12 月 20 日
....
panlilu
2011 年 12 月 20 日
@acgism 什么时候自己做个独立项目这么干一下~
benzhe
2011 年 12 月 20 日
http://www.jb51.net/css/24946.html

但是这一条貌似IE9和Opera都支持:
color:red\0; /* IE8支持 */
bitsmix
2011 年 12 月 20 日
不过不建议用这种 css hack
因为写出来的css都是invalid的
Sivan
2011 年 12 月 20 日
http://lightcss.com/best-way-to-different-browser-for-css/

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->

易维护,符合标准。
kongruxi
2011 年 12 月 20 日
可以参考一下html5boilerplate

http://html5boilerplate.com/
thewei
2011 年 12 月 20 日
@Sivan 这种会容易维护,推荐。但如果是极个别而且只是小范围调整的样式可以用\0属性hack来指定只能IE8能识别这个样式,例如 #id { color: blue\0; }
Sivan
2011 年 12 月 20 日
@thewei 是啊。不过 CSS 代码不合标准的话有些前端心里会难受的。哈哈。
thewei
2011 年 12 月 20 日
@Sivan 标准是可以给打破的,这两年学下来我觉得灵活用就行,呵呵。而且属性hack到最后可以也很容易查找出来。
avatasia
2011 年 12 月 20 日
死抱着标准不放的人,永世受

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/23918

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX