<!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