this blog is a collection of resouces i like, some post are created by myself (which will be in mine menu) and other are taken form online. source link will be place in every post.

I am working as web designer, wordpress and joomla customization. and i love open source. Don't you.

All the materials are keep for education and fun propose only.

Comment and feedback is always welcome.

Wednesday, June 6, 2012

best trick to css hack for ie browser


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{ visibility: inherit; } IE PHP Browser Sniffer</title>
<?php $browser = ''; for($i = 6; $i<9; $i++ ) { if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE $i.0")) $browser = 'class="ie'.$i.'"';} ?>
<style type="text/css">
.ie6 p {color:red;}
.ie7 p {color:green;}
.ie8 p {color:blue;}
</style>
</head>
<body <?php echo $browser; ?>>

<p>Some Text</p>

</body>
</html>
source >> http://www.visibilityinherit.com/code/ie-php-browser-sniffer.php

the other way i usually use is
<!-- css hack for ie8 only --> 
<!--[if IE 8]>
<style>
p {
    height: 100px;
}
</style>
<![endif]-->

<!-- css hack for ie9 only --> 
<!--[if IE 9]>
<style>

p {
    height: 200px;
}
</style> <![endif]-->

No comments:

Post a Comment