Skip to content

Instantly share code, notes, and snippets.

@HungYuHei
Created July 27, 2011 15:24
Show Gist options
  • Save HungYuHei/1109606 to your computer and use it in GitHub Desktop.
Save HungYuHei/1109606 to your computer and use it in GitHub Desktop.
ie hack
selector{
property:value; /* all browser */
property:value\9; /* all IE */
padding:8px\0; /* ie8-9 */
*padding:5px; /* ie6-7 */
+property:value; /* IE7 */
_property:value; /* IE6 */
}
<!--[if !IE]>NOT IE<![endif]-->
<!--[if IE]>IE only<![endif]-->
<!--[if IE 8]>不错不错,挺先进的嘛,使用IE8呢!文字是褐色的。<![endif]-->
<!--[if IE 7]>你,IE7,红色文字!<![endif]-->
<!--[if IE 6]>孩子,虽然显示的是绿色文字,不过,IE6可不是好东西呢!<![endif]-->
// 以jQuery为例,检测是否是IE6,是则加上class="ie6"
if ($.browser.msie && $.browser.version = 6 ) {
$('div').addClass('ie6');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment