`
ayue222
  • 浏览: 47983 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

区分IE6、IE7、IE8、Firefox2、Firefox3的CSS hacks

阅读更多
IE8正式版已经发布,对于网页设计者来说,在不开启IE8的兼容模式下,网站能否正常显示成了一个需要注意的问题,虽然IE8号称更加符合标准,但还是会出现局部显示不正确的bug,本站以前提供过一次有关于IE8的Hack,见《IE6、IE7、IE8、FF的简单Hack》,发现那里面提供的有关IE8那个hack好像并不起作用,本文提供一个可以同时区分IE6、IE7、IE8、Firefox2、Firefox3的CSS hacks,方便在IE8下局部显示不正确的时候进行调整,避免重写CSS,经过测试,这种IE8 的hacks可用。

可同时区分IE8、IE7、IE6、Firefox3、Firefox2的CSS hacks:

CSS代码
 
.test{   
     color:/*\**/#00f\9; /* IE8 */   
}   
.test,   
.test:-moz-any-link{   
     color:#f60; /* Firefox2 */   
}   
.test,   
.test:default{   
     color:#000; /* Firefox3 */   
     *color:#f00; /* IE7 */   
     _color:#0f0; /* IE6 */   
}   

可同时区分IE8、IE7、IE6、Firefox的CSS hacks:


CSS代码
.test{   
     color:#000; /* Firefox */   
     color:/*\**/#00f\9; /* IE8 */   
     *color:#f00; /* IE7 */   
     _color:#0f0; /* IE6 */   
}   
 


关于IE8的hacks:


CSS代码
 
.test{   
     color:/*\**/#00f\9; /* IE8 only */   
     color:#00f\9; /* 适用于所有IE版本 */   
}   

       虽然这个hacks可用,但还是希望能够尽量少用或者不用hacks,从显示不正常的原因着手解决问题才能达到完美,毕竟hack的写法不符合也通不过w3c对样式表的交验。
分享到:
评论

相关推荐

    网页制作需要了解的IE8、IE7、IE6、Firefox3、Firefox2的CSS hacks

    复制代码代码如下: .test{ color:/*\**/#00f\9; /* IE8 */ } .test, .test:-moz-any-link{...可同时区分IE8、IE7、IE6、Firefox的CSS hacks: CSS代码 复制代码代码如下: .test{ color:#000; /* Firefox */ color:/*\

    browser-hack-sass-mixins:浏览器hack sass mixin-将SCSS应用于特定的浏览器-CSS hacks:IE,Chrome,Firefox,Edge,Opera

    browser-hack-sass-mixins:浏览器hack sass mixin-将SCSS应用于特定的浏览器-CSS hacks:IE,Chrome,Firefox,Edge,Opera

    浏览器特定的CSS Hacks汇总

     利用这些CSS Hacks,你能够更好的针对IE、Chrome、Firefox、Opera和Safari,代码如下: 浏览器特定的CSS Hacks综合列表: 复制代码代码如下:/***** Selector Hacks ******//* IE6 and below */* ...

    firefox-csshacks:影响浏览器的用户样式集合

    Firefox的随机CSS hack集合 该存储库包含各种样式,以修改Mozilla Firefox的外观。 这些样式表大多是独立的,可以自由地相互混合,但是不能保证与第三方样式的兼容性。 如果某个特定样式依赖于另一种样式,则将在...

    CSS Cookbook, 3rd Edition

    You’ll learn about the behavior of the latest browsers-including IE 8, Firefox 3, Safari 4, and Google Chrome-and how you can resolve differences in the ways they display your web pages. Arranged in...

    The CSS Anthology: 101 Essential Tips, Tricks & Hacks, 3rd Edition

    selling book, published in full color, has been completely revised and updated to cover the latest techniques and newer browsers, including Firefox 3 and Internet Explorer 8.It’s the most complete ...

    Pro HTML5 and CSS3 Design Patterns

    Each design pattern has been thoroughly tested and proven to work in all major web browsers including Chrome, Firefox, Internet Explorer, Opera, and Safari. All the content in this book is usable and ...

    web实验报告.doc

    掌握文本控制相关的属性 掌握CSS属性继承的概念并能够合理应用 掌握背景控制相关的CSS属性 掌握列表相关的CSS属性 熟悉Chrome/Firefox开发人员工具中CSS相关功能的使用 了解常见的CSS设计技巧(CSS Hacks)和设计...

    30个开发人员有用的CSS代码片段整理值得借鉴

    他可以兼容新旧不同的浏览器,他的兼容跨度确实够大的,从微软的IE到火狐再到谷歌浏览器。在设计的时候我们总是想创建更有创意和风格的网站,无论创建怎么样的网站,有些CSS代码是必须要掌握的,可以说这是核心,...

    Ebooks For Dummies Collection

    Firefox For Dummies.chm Firewalls For Dummies 2nd Ed.pdf Flash CS3 For Dummies May 2007.pdf ** Food Allergies For Dummies.pdf For Dummies Flash CS3 For Dummies May 2007.pdf For Dummies Macs For ...

Global site tag (gtag.js) - Google Analytics