You are here: Daniel Dumas » Blog, CSS »

Internet Explorer (IE) or CSS Conditional Statements

Internet Explorer (IE) or CSS Conditional Statements

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 :)

Discussion

  1. [...] Go to the author’s original blog: Internet Explorer (IE) or CSS Conditional Statements [...]

  2. don_ser says:

    out of the topic… ang ganda ng header image mo ah. nice idea. hehe. anu software gamit mo sa paggawa nyan???

    don_ser’s last blog post..My Highest Google Earning… weeeeeeeh

  3. …dropping by to say Happy Halloween! :)

  4. pooja says:

    u r site is very nice

    #
    # Hi There! You are using Internet Explorer 6
    #
    i want more deep example of this statement
    please give me that good example

  5. Jon kline says:

    I enjoyed reading your post and really like your style. I have bookmarked for future visits …. Keep up the good work

  6. Aaron Benson says:

    I enjoyed reading this article. It seems that you are a great source of information. Keep them coming.

  7. I have been bookmarking several sites with printable grocery coupons. If you want my list let me know. I am sure you’re like us, needing to save every dime you can.

  8. ruchi says:

    hello really a nice one..can you provide more information on this?i m interested

  9. Great post! I read your other posts as well and I subscribed to your RSS Feed!

    Regards,
    Mike

  10. Moues says:

    Do let us know if you have up to date news…

  11. Gabby says:

    Your blog is like an encyclopedia to me. If i need something I just go here and search…and hola! I get it! Great to have some expert bloggers around like you…..

  12. Kean yao says:

    I dont like internet explorer, firefox is much much much better than that.

  13. nirav says:

    nice tutorial

Leave a Reply





CommentLuv badge