Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. IE Invisible DIV Bug

IE Invisible DIV Bug

Scheduled Pinned Locked Moved The Weird and The Wonderful
htmlcsscomarchitecturehelp
7 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #1

    Below is an HTML file. Try to guess which DIV will be invisible in IE, then scroll down to see why...

    <html>
    <head>
    <title>WTF</title>
    <style type="text/css">
    div
    {
    filter: alpha(opacity = 100);
    border-color: Green;
    border-style: solid;
    border-width: 1px;
    width: 100px;
    height: 100px;
    }
    </style>
    </head>
    <body>
    <div style="background-color: #020509;"></div>
    <div style="background-color: #02050A;"></div>
    <div style="background-color: #02050B;"></div>
    </body>
    </html>

    The middle DIV will be transparent because any element with the color #02050A that also has the filter set to an opacity (even if fully opaque) will appear transparent in IE8 (and probably other versions of IE).

    [Forum Guidelines]

    L 1 Reply Last reply
    0
    • A AspDotNetDev

      Below is an HTML file. Try to guess which DIV will be invisible in IE, then scroll down to see why...

      <html>
      <head>
      <title>WTF</title>
      <style type="text/css">
      div
      {
      filter: alpha(opacity = 100);
      border-color: Green;
      border-style: solid;
      border-width: 1px;
      width: 100px;
      height: 100px;
      }
      </style>
      </head>
      <body>
      <div style="background-color: #020509;"></div>
      <div style="background-color: #02050A;"></div>
      <div style="background-color: #02050B;"></div>
      </body>
      </html>

      The middle DIV will be transparent because any element with the color #02050A that also has the filter set to an opacity (even if fully opaque) will appear transparent in IE8 (and probably other versions of IE).

      [Forum Guidelines]

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Quite a feature. This[^] seems to suggest one is in trouble as soon as some pixel in an image has that particular color!? :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      A 1 Reply Last reply
      0
      • L Luc Pattyn

        Quite a feature. This[^] seems to suggest one is in trouble as soon as some pixel in an image has that particular color!? :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #3

        Quite right; that's actually one of the links I came across when Googling this issue. I am using jQuery to fade between images for a slideshow. Only problem is that some of the pixels would appear white during the fade transition. Turns out this IE bug is the reason why that's happening. The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black. We could have also edited each image so the pixels weren't that specific color, but that's a bit hard to do when JPEG compression can alter colors... and I don't think the artists would appreciate having to edit a certain color out of all their images.

        [Forum Guidelines]

        D H 2 Replies Last reply
        0
        • A AspDotNetDev

          Quite right; that's actually one of the links I came across when Googling this issue. I am using jQuery to fade between images for a slideshow. Only problem is that some of the pixels would appear white during the fade transition. Turns out this IE bug is the reason why that's happening. The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black. We could have also edited each image so the pixels weren't that specific color, but that's a bit hard to do when JPEG compression can alter colors... and I don't think the artists would appreciate having to edit a certain color out of all their images.

          [Forum Guidelines]

          D Offline
          D Offline
          Daniel Tak M
          wrote on last edited by
          #4

          The real fix is to not use IE at all (not really an option, of course)

          1 Reply Last reply
          0
          • A AspDotNetDev

            Quite right; that's actually one of the links I came across when Googling this issue. I am using jQuery to fade between images for a slideshow. Only problem is that some of the pixels would appear white during the fade transition. Turns out this IE bug is the reason why that's happening. The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black. We could have also edited each image so the pixels weren't that specific color, but that's a bit hard to do when JPEG compression can alter colors... and I don't think the artists would appreciate having to edit a certain color out of all their images.

            [Forum Guidelines]

            H Offline
            H Offline
            Hired Mind
            wrote on last edited by
            #5

            aspdotnetdev wrote:

            The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black.

            Could you use a background color that was 1 RGB value from from the transparent color? (e.g. #02050B instead of black) I think the difference wouldn't even be perceptible at that point.

            Before .NET 4.0, object Universe = NULL;

            A 2 Replies Last reply
            0
            • H Hired Mind

              aspdotnetdev wrote:

              The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black.

              Could you use a background color that was 1 RGB value from from the transparent color? (e.g. #02050B instead of black) I think the difference wouldn't even be perceptible at that point.

              Before .NET 4.0, object Universe = NULL;

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #6

              That's basically what we did, but we chose black, which is close enough to the color that the difference is imperceptible.

              [Forum Guidelines]

              1 Reply Last reply
              0
              • H Hired Mind

                aspdotnetdev wrote:

                The fix we decided on was to put a black image behind the images so that the transparent pixels will appear to be black.

                Could you use a background color that was 1 RGB value from from the transparent color? (e.g. #02050B instead of black) I think the difference wouldn't even be perceptible at that point.

                Before .NET 4.0, object Universe = NULL;

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #7

                Oh, do you mean change the color of the ORIGINAL image, rather than the image behind it? As I explained in the post you replied to, that would be extra work for the designers and, due to JPEG compression, would be troublesome.

                [Forum Guidelines]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups