Results 1 to 2 of 2

Thread: How can I make a div show up only in IE6 and below?

  1. #1
    Join Date
    Apr 2008
    Posts
    84
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How can I make a div show up only in IE6 and below?

    My site uses some fixed position divs, so it's a horrendous mess in IE6 and below, so I was wondering if I can have a div show up just in IE6 and below?

    To say something like "Upgrade to IE7, or better yet, get Firefox".

    Maybe with a browser sniffer script? Or just using CSS?

    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can use IE conditional comments for that. A good approach because it is a supported feature, not a hack:

    HTML Code:
    <!--[if lt IE 7]>
    <div>Whatever's here, only IE 6 and below will see.</div>
    <![endif]-->
    The meaning is literally 'if less than IE 7'. This will only be looked at by IE 5+. All others will see it as a comment (thus ignore the div), and IE 7 will see it as a conditional comment to ignore.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •