Eysa
V2EX  ›  问与答

CSS 怎么写 只有IE8能识别?

  •  
  •   Eysa · Dec 20, 2011 · 6655 views
    This topic created in 5431 days ago, the information mentioned may be changed or developed.
    就IE8 最邪恶!
    15 replies  •  1970-01-01 08:00:00 +08:00
    acgism
    acgism
    Dec 20, 2011
    1
    <!--[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
    underone
    Dec 20, 2011
    2
    这个。。如果不用if的话。。。
    后缀“\9”应该是让8以下的IE全部识别吧(还是9以下的)
    然后再用_和+做前缀分别识别6和7...8就出来了...
    当然这是笨办法...

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

    不知道是不是可以啊...记得不太清楚了...
    Eysa
    Eysa
    OP
    Dec 20, 2011
    3
    这个。。。 能否在 CSS 里写个什么的。还要外链?
    Eysa
    Eysa
    OP
    Dec 20, 2011
    4
    <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
    acgism
    Dec 20, 2011
    5
    @Eysa 或者直接放弃IE 识别到IE内核的浏览器就直接跳转到这样的一个页面http://acgism.com/Just_say_no_to_IE/ (抽打,拖走。。。。
    Eysa
    Eysa
    OP
    Dec 20, 2011
    6
    ....
    panlilu
    panlilu
    Dec 20, 2011
    7
    @acgism 什么时候自己做个独立项目这么干一下~
    benzhe
    benzhe
    Dec 20, 2011
    8
    http://www.jb51.net/css/24946.html

    但是这一条貌似IE9和Opera都支持:
    color:red\0; /* IE8支持 */
    bitsmix
    bitsmix
    Dec 20, 2011
    9
    不过不建议用这种 css hack
    因为写出来的css都是invalid的
    Sivan
    Sivan
    Dec 20, 2011
    10
    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
    kongruxi
    Dec 20, 2011
    11
    可以参考一下html5boilerplate

    http://html5boilerplate.com/
    thewei
    thewei
    Dec 20, 2011
    12
    @Sivan 这种会容易维护,推荐。但如果是极个别而且只是小范围调整的样式可以用\0属性hack来指定只能IE8能识别这个样式,例如 #id { color: blue\0; }
    Sivan
    Sivan
    Dec 20, 2011
    13
    @thewei 是啊。不过 CSS 代码不合标准的话有些前端心里会难受的。哈哈。
    thewei
    thewei
    Dec 20, 2011
    14
    @Sivan 标准是可以给打破的,这两年学下来我觉得灵活用就行,呵呵。而且属性hack到最后可以也很容易查找出来。
    avatasia
    avatasia
    Dec 20, 2011
    15
    死抱着标准不放的人,永世受
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3132 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 10:45 · PVG 18:45 · LAX 02:45 · JFK 05:45
    ♥ Do have faith in what you're doing.