CSS Hack
只针对ie6,ie7和firefox的csshack
注意都要写在正常样式的后边,除!important方法在前边
---------------针对样式名------------
如果只让ie6看见用*html .head{color:#000;}
如果只让ie7看见用*+html .head{color:#000;}
如果只让ff看见用:root body .head{color:#000;}
如果只让ff、IE8看见用html>/**/body .head{color:#000;}
如果只是不让ie6看见用html>body .head{color:#000;} 即对IE 6无效
如果只是不让ff、IE8看见用*body .head{color:#000;} 即对ff、IE8无效
body>.head{color:#000} IE7 8 ff 有效
-------------针对具体属性--------------
如果只让ie6看见用_ .head{_color:#000;}
如果只让ie7看见用+与_结合的方法: .head{+color:#f00;!;_color:#000;}
如果只是不让ie6看见用 /**/ .head{color /**/:#000;}注意有空格,或者用!important,写法: width:20px!important; width:50px;
如果只对ff无效/9 >.head{color:#000\9}
--------------------------------------------------IE8正式版hack---------------------------------
"\9" 例:"margin:0px auto\9;".这里的"\9"可以区别所有IE和FireFox.
"*" IE6、IE7可以识别.IE8、FireFox不能.
"_" IE6可以识别"_",IE7、IE8、FireFox不能.
如:.a {color:#f00; color:#f60\9; +color:#00FF00; _color:#0000FF; }
ff IE8 IE7 IE6
相关文档:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS选项卡效果代码演示</title>
</head>
<body>
<mce:style type="text/css"><!--
div.card div{
background-color:#FF8 ......
效果如下:
实现方法:利用一下两张图片:
前台代码:
<div id="nagivation">
&nb ......
当div层为float时,IE6中box左右的margin会加倍
比如:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htm ......
DOCTYPE 影响 CSS 处理
Firefox: div 设置 margin-left, margin-right 为 auto 时已经居中, IE 不行
Firefox: body 设置 text-align 时, div 需要设置 margin: auto(主要是 margin-left,margin-right) 方可居中
Firefox: 设置 padding 后, div 会增加 height 和 width, 但 IE 不会, 故需要用 !important 多设一个 heig ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TAO BAO TEST 2&l ......