Internet Explorer (IE) or CSS Conditional Statements
Posted by Daniel at 3:36 am
Internet Explorer conditional statement or CSS Conditional statements is a bit of code specially made for Internet Explorer browers which instructs ie browser to perform specific instructions only for internet explorer browser, only windows platform supports ie conditional statements.
the basic structure or syntax of conditional statements is just..like plain HTML comments so therefore you can only use it inside an html file..
here are some examples of Internet Explorer Conditional Statement syntax
<!--[if IE 6]> enter your instructions for ie6 here <![endif]-->
<!--[if gte IE 5]> enter your instructions for ie browers greater than or equal to ie5 <![endif]-->
<!--[if lte IE 6]> enter your instructions for ie browsers lower or equal to ie6 <![endif]-->
<!--[if lt IE 6]> enter your instructions for ie browsers lower than ie6 <![endif]-->
<!--[if gt IE 6]> enter your instructions for ie6 here <![endif]-->
this is very usefull for example if you want to separate a css file for different different versions
of internet explorer you can use this, or if you want to output messages to your site visitor telling
them that they are using ie. here are some examples
Using conditional statement to separate css stylesheet
<!--[if IE 6]> <link rel="stylesheet" type="text/css" href="ie6.css"> <![endif]-->
<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="ie7.css"> <![endif]-->
Using Conditional statement to output text to the browser
<!--[if IE 6]> Hi There! You are using Internet Explorer 6 <![endif]-->
<!--[if IE 5]> Hi there! You are a legend your still using IE5? <![endif]-->
Enjoy
[...] Go to the author’s original blog: Internet Explorer (IE) or CSS Conditional Statements [...]