网络编程
位置:首页>> 网络编程>> 网页设计>> 不同浏览器的兼容一些写法

不同浏览器的兼容一些写法

 来源:byzuo.cn 发布时间:2009-03-26 12:58:00 

标签:浏览器,兼容,CSS,Hack

[Hack] 意为”劈”、”砍”。 [Hacker] 意为”黑客”

CSS Hack 是指针对不同的浏览器写不同的CSS code的过程,简单的说是为了兼容不同浏览器所做的一系列补救措施。

CSS Hack制作:

正确的理解和仔细的分析你自己的页面,正确的构架可以减少CSS Hack的使用

由于浏览器对某些CSS code解释的不同,Hack只是这个过渡时期的产物,如果所有的东西都向标准这个东西看齐的话,以前带Hack的网站还得改版,所以尽量少的使用Hack。部分Hack方法整理如下:

事件一

.box {
width:100px!important; /* hack for ie7+FF */
width:120px; /* hack for ie6 */
}

事件二

.box {
width:100px; /* hack for FF */
*width:120px; /* hack for ie6+ie7 */
}

事件三

.box {
width:100px!important; /* hack for FF */
*width:120px!important; /* hack for ie7 */
*width:150px; /* hack for ie6 */
}
.box { width: 120px; } /* hack for FF */
*html .box { width: 80px;} /* hack for ie6 */
*+html .box { width: 60px;} /* hack for ie7 */

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com