惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 散步的蠕虫

【转载】Javascript标准DOM Range操作 [收藏]winform拖动方法 [收藏]SQL SERVER2005自动备份 [更新+源码]一个随时随地随便记的超轻量级的记事本软件WheneverNote V1.0.9.218 [发布+源码]一个随时随地随便记的超轻量级的记事本软件WheneverNote V1.0.9.215 [总结]Server Application Error(IIS5 HTTP500)内部错误分析及解决办法 [转载]XML和HTML常用转义字符 C# TO Excel 新概念III WCF - Message Security with Mutual Certificates WCF - Common Security Scenarios 【转载】LINQ to SQL (Part 5 - Binding UI using the ASP:LinqDataSource Control) 【转载】LINQ to SQL (Part 4 - Updating our Database) 【转载】LINQ to SQL (Part 3 - Querying our Database) 【转载】LINQ to SQL (Part 2 - Defining our Data Model Classes) 【转载】Using LINQ to SQL (Part 1) 常用开发辅助工具清单 JavaScript 实用方法库 Local Resource应用概述
[整理收藏]CSS Hack IE6,IE7,IE8 and Firefox
散步的蠕虫 · 2010-05-04 · via 博客园 - 散步的蠕虫

浏览器HACK

_

*

\9

!important

IE6

×

IE7

×

IE8

×

×

Firefox

×

×

×

1.区别IE和非IE浏览器

#tip {
background
:blue; /*非IE 背景藍色*/
background
:red \9; /*IE6、IE7、IE8背景紅色*/
}


2.区别IE6,IE7,IE8,FF

【区别符号】:「\9」、「*」、「_
【示例】:

#tip {
background
:blue; /*Firefox 背景变蓝色*/
background
:red \9; /*IE8 背景变红色*/
*background
:black; /*IE7 背景变黑色*/
_background
:orange; /*IE6 背景变橘色*/
}

【说明】:因为IE系列浏览器可读「\9」,而IE6和IE7可读「*」(米字号),另外IE6可辨识「_」(底线),因此可以依照顺序写下来,就会让浏 览器正确的读取到自己看得懂得CSS语法,所以就可以有效区分IE各版本和非IE浏览器(像是Firefox、Opera、Google Chrome、Safari等)。


3.区别IE6、IE7、Firefox (方法 1)

【区别符号】:「*」、「_
【示例】:

#tip {
background
:blue; /*Firefox背景变蓝色*/
*background
:black; /*IE7 背景变黑色*/
_background
:orange; /*IE6 背景变橘色*/
}

【说明】:IE7和IE6可读「*」(米字号),IE6又可以读「_」(底线),但是IE7却无法读取「_」,至于Firefox(非IE浏览器)则完全 无法辨识「*」和「_」,因此就可以透过这样的差异性来区分IE6、IE7、Firefox


4.区别IE6、IE7、Firefox (方法 2)

【区别符号】:「*」、「!important
【示例】:

#tip {
background
:blue; /*Firefox 背景变蓝色*/
*background
:green !important; /*IE7 背景变绿色*/
*background
:orange; /*IE6 背景变橘色*/
}

【说明】:IE7可以辨识「*」和「!important」,但是IE6只可以辨识「*」,却无法辨识「!important」,至于Firefox可以 读取「!important」但不能辨识「*」因此可以透过这样的差异来有效区隔IE6、IE7、Firefox。


5.区别IE7、Firefox

【区别符号】:「*」、「!important
【示例】:

#tip {
background
:blue; /*Firefox 背景变蓝色*/
*background
:green !important; /*IE7 背景变绿色*/
}

【说明】:因为Firefox可以辨识「!important」但却无法辨识「*」,而IE7则可以同时看懂「*」、「!important」,因此可以 两个辨识符号来区隔IE7和Firefox。


6.区别IE6、IE7 (方法 1)

【区别符号】:「*」、「_
【示例】:

#tip {
*background
:black; /*IE7 背景变黑色*/
_background
:orange; /*IE6 背景变橘色*/
}

【说明】:IE7和IE6都可以辨识「*」(米字号),但IE6可以辨识「_」(底线),IE7却无法辨识,透过IE7无法读取「_」的特性就能轻鬆区隔 IE6和IE7之间的差异。


7.区别IE6、IE7 (方法 2)

【区别符号】:「!important
【示例】:

#tip {
background
:black !important; /*IE7 背景变黑色*/
background
:orange; /*IE6 背景变橘色*/
}

【说明】:因为IE7可读取「!important」但IE6却不行,而CSS的读取步骤是从上到下,因此IE6读取时因无法辨识 「!important」而直接跳到下一行读取CSS,所以背景色会呈现橘色。


8.区别IE6、Firefox

【区别符号】:「_
【示例】:

#tip {
background
:black; /*Firefox 背景变黑色*/
_background
:orange; /*IE6 背景变橘色*/
}

【说明】:因为IE6可以辨识「_」(底线),但是Firefox却不行,因此可以透过这样的差异来区隔Firefox和IE6,有效达成CSS hack。

9. Chrome和safari的CSS hack代码

只有谷歌浏览器苹果浏览器读取:

@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Webkit内核兼容CSS */
}