Clever way to introduce css hacks
Recently I need cross browser inline-block solution. As you know, inline-block is not supported by Internet Explorer 7 and 6. So I start to code my css and comeout with this solution after referring some tips from the Internet.
.makeinlineblock {display: inline-block }
* html .makeinlineblock { display:inline; } /* for IE 6 */
* + html .makeinlineblock { display:inline; } /* for IE 7 */
Not very pretty. So I make simple javascript coding using jQuery to make my css looks better.
$(function(i,j){
var browserVersion=Math.floor(parseFloat($.browser.version)),body=$("body");
for(i in $.browser){
if(i!=="version"){
body.addClass([i,i + "-" + browserVersion,i + "-gt-" + (browserVersion-1),i + "-lt-" + (browserVersion+1)].join(" "))
}
}
});
Now I can code my css like this.
.makeinlineblock { display: inline-block }
.msie-lt-8 .makeinlineblock {display: inline }
Prettier isn’t it? Not fully tested. Use it at your own risk. It works for me.

