The question of CSS hack
July 7th, 2011 by NikI had read this in some blog. Thought it was nice to catalog this for future ref. and also could be an important interview question that you would be asked some day.
Write a snippet of CSS that will display a paragraph in blue in older browsers, red in newer browsers, green in IE6 and black in IE7
#content p{color:blue} /* New Browsers */
html>body #content p {color:red} /* Older Browsers */
* html #content p{color:green} /* IE 6 only Hack */
html>body #content p {*color:black;} /* IE 7 only Hack*/
PS. Sorry! I haven’t tested it!!!
Subscribe to ExpressingIT by Email | Follow Me on Twitter