1

css hack(*display:inline)

 2 years ago
source link: https://www.80shihua.com/archives/354
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

css hack(*display:inline)

作者: dreamfly 分类: css 发布时间: 2015-03-18 22:01

不同浏览器或者相同浏览器不同版本,这里主要专指IE的各个版本,IE和非IE内核浏览器对相同css有不同解析结果产,得不到所需效果来说的。我们使用css hack.

CSS hack的目的就是使你的CSS代码兼容不同的浏览器。当然,我们也可以反过来利用CSS hack为不同版本的浏览器定制编写不同的CSS效果。

同理还有头部引用(if IE)Hack:<!--[if IE]><!--您的代码--><![endif]-->,针对IE6及以下版本:<!--[if lt IE 7]><!--您的代码--><![endif]-->,这类Hack不仅对CSS生效,对写在判断语句里面的所有代码都会生效。

还有选择器Hack:比如 IE6能识别*html .class{},IE7能识别*+html .class{}或者*:first-child+html .class{}。等等

css hack 举例:

_background-color:#CDCDCD;/*ie6*/

*display:block;/*ie6,7*/

*background:blue;/*ie6,7*/

background-color:red \0; /*ie8*/

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK