/ Published in: CSS
CSS hacks
Expand |
Embed | Plain Text
Although it would be good to write code that renders well across all browsers, sometimes you got to rely on some dirty tricks to punch ie6 below the belt. Here are some hacks I know. Conditional Comments (For all version of IE) http://www.quirksmode.org/css/condcom.html This hack can be used to target a specific IE version, or across multiple versions. The most ethical way to implement it is to use it to direct IE browsers to an alternative stylesheet. <!--[if IE 6]> <link href="ie6.css" type="text/css" rel="stylesheet" /> <![endif]--> Asterisk( * ), Underscore( _ ) and a whole bunch of characters ( /*\**/ /9 ) hack (For IE) No specific link, google yourself Use the * hack for IE7. However, it will affect IE6 as well, making it sometimes neccesary to hack both. normal css > display: none; hacked css > *display: none; Use the _ hack for IE6. normal css > display: none; hacked css > _display: none; Use the /*\**/ /9 hack for IE8. normal css > display: none; hacked css > display /*\**/: none\9 } Chrome Hack (Apparently targets all Webkit Browsers including Safari) http://www.evotech.net/blog/2008/09/css-hack-for-google-chrome-and-safari-31/ Rarely happens, because Chrome's CSS rendering is pretty standard. But has happened to me. @media screen and (-webkit-min-device-pixel-ratio:0) { .invisbile: display: none; } That's about all the browsers you would usually encounter problems with during IntEgration. Conditional Comments are the best method and keep in mind that the other hacks are non-standard html/css.
You need to login to post a comment.
