Chinaunix首页 | 论坛 | 博客
  • 博客访问: 107760
  • 博文数量: 23
  • 博客积分: 1546
  • 博客等级: 上尉
  • 技术积分: 170
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-18 19:47
文章分类

全部博文(23)

文章存档

2012年(1)

2011年(6)

2010年(3)

2009年(13)

我的朋友

分类:

2010-12-29 12:06:03

由于不同的浏览器,比如Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等,对CSS的解析认识不一样,因此会导致生成的页面效果不一样,得不到我们所需要的页面效果。

这个时候我们就需要针对不同的浏览器去写不同的CSS,让它能够同时兼容不同的浏览器,能在不同的浏览器中也能得到我们想要的页面效果。

这个针对不同的浏览器写不同的CSS code的过程,就叫CSS hack。

区别不同浏览器,CSS hack有不同的写法:

区别IE6与FF:

background:orange;*background:blue;

区别IE6与IE7:

background:green !important;background:blue;

区别IE7与FF:

background:orange; *background:green;

区别FF,IE7,IE6:

background:orange;*background:green !important;*background:blue;

注意事项:
◆IE都能识别*;标准浏览器(如FF)不能识别*;
◆IE6能识别*,但不能识别 !important,
◆IE7能识别*,也能识别!important;
◆FF不能识别*,但能识别!important;

另外再补充一个,下划线"_",

IE6支持下划线,IE7和firefox均不支持下划线。

于是大家还可以这样来区分IE6,IE7,Firefox

background:orange;*background:green;_background:blue;

注:不管是什么方法,书写的顺序都是firefox的写在前面,IE7的写在中间,IE6的写在最后面。

阅读(789) | 评论(1) | 转发(0) |
0

上一篇:忠告

下一篇:实战 SSH 端口转发

给主人留下些什么吧!~~

chinaunix网友2011-01-03 14:48:15

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com