Dynamic Guru - The Web and Technology Blog


ajax css design featured freebies google html internet javascript jquery php seo technology tools web wordpress wordpress themes xhtml
 
Posts tagged with —ie 6 bug solution

How to write browser specific css

Usually when it comes to browser specific css we often mean IE specific code. You might be aware of the conditional comments tag you can use to target different versions of Internet Explorer. But 2day i’ll be showing you a much simpler way to tame IE 6 and 7 to your needs . Lets suppose for some reasons you want a div to have a height of 10px in all browsers, but a height of 12px in IE 7 and 15px in IE 6, here is how it can be done without the use of conditional comments:

div {
//for all browsers
height:10px;

//for IE 6,others will ignore this
_height:15px;

//for IE 7
*height:12px
}

isnt it much simpler than writing conditional comments?
The same technique can be applied to other properties as well. You can even use this hack to request your IE 6 users to upgrade to a modern browser,how? Just make a div and write your message in it and set its “display” to “none” while set “_display” to “block”.This will simply tell all browsers not to display the div while IE 6 will. Hope you enjoyed the post.

© 2012 Dynamic Guru All rights reserved - About Us - WordPress themes - Mujtaba Ahmad