NOTE: Works in Internet Explorer but the style is also picked up and used by Firefox (Firefox merely ignores the "if IE" and "endif" logic.
<style type="text/css">
.cItem {
display: block;
background-color: #454343;
width: 360px;
height: 19px;
padding-left: 5px;
padding-top: 3px;
}
</style>
<!-[ if IE]>
<style type="text/css">
.cItem {
background-color: red;
width: 360px;
height: 22px;
padding-left: 5px;
}
</style>
<![endif]->
|
NOTE: Internet Explorer does not detect the conditional statement since it is in a true comment tag, but neither does Firefox.
<style type="text/css">
.cItem {
display: block;
background-color: #454343;
width: 360px;
height: 19px;
padding-left: 5px;
padding-top: 3px;
}
</style>
<!--[ if IE]>
<style type="text/css">
.cItem {
background-color: red;
width: 360px;
height: 22px;
padding-left: 5px;
}
</style>
<![endif]-->
|
NOTE: Internet Explorer does not detect the conditional statement because it resides in a comment block (which is unfortunate), but neither does Firefox.
<style type="text/css">
.cItem {
display: block;
background-color: #454343;
width: 360px;
height: 19px;
padding-left: 5px;
padding-top: 3px;
}
</style>
<!--
<!-[ if IE]>
<style type="text/css">
.cItem {
background-color: red;
width: 360px;
height: 22px;
padding-left: 5px;
}
</style>
<![endif]->
-->
|
<script language="javascript" type="text/javascript">
if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) { /*IE*/
document.write("<style type=\"text/css\">")
document.write(".cItem {")
document.write("background-color: #454343;")
document.write("width: 360px;")
document.write("height: 21px;")
document.write("font-size: 0;")
document.write("padding-left: 5px;")
document.write("padding-top: 3px;")
document.write("}")
document.write("</style>")
}
else {
document.write("<style type=\"text/css\">")
document.write(".cItem {")
document.write("display: block;")
document.write("background-color: #454343;")
document.write("width: 360px;")
document.write("height: 19px;")
document.write("padding-left: 5px;")
document.write("padding-top: 4px;")
document.write("}")
document.write("</style>")
}
</script>