views:

157

answers:

2

Hi,

I have a pseudo-gallery set up to display thumbnails and display enlarged image when hovered on thumbnails. The enlarged image is positioned relative to its parent thumbnail.

This works in Google chrome and Mozilla Firefox but not in IE8.

I have done some research with no progress on the matter. In IE8, both thumbnail and enlarged image are displayed. Neither 'Visibility: Hidden', 'hover' nor 'absolute position' seem to work in IE8.

Would appreciate any help. the following is a snippet of code:

.main{
     float:right;
     display: block;
     Background-color:transparent;
     Margin: 20px 55px 20px 10px;
}

.main img{
     display: block;
     border:0;
}

.main:hover{
     background-color:#ffffff;
     position: relative;
     visibility:visible;
     z-index: 1400;
}

/*for bigger images*/
.main bigger {
     width: 500px;
     height: 500px;
     position: absolute;
     left: -2000px;
     visibility: hidden;
     overflow: hidden;
     background-color:transparent;
     border:0;
}

.main:hover img{
     z-index: 1400;
     position: relative;
}

.main:hover bigger{
     z-index: 1500;
     display:block;
     width: 500px;
     height: 500px;
     top: -100px;
     left: 200px;
     overflow: visible;
     visibility: visible;
     background-color: transparent;
     clear: none;
}

THANKS

A: 
/*for bigger images*/ 
.main bigger { width: 500px; height: 500px; position: absolute; left: -2000px; visibility: hidden; overflow: hidden; background-color:transparent; border:0; }

.main:hover img{ z-index: 1400; position: relative; }

.main:hover bigger{ z-index: 1500; display:block; width: 500px; height: 500px; top: -100px; left: 200px; overflow: visible; visibility: visible; background-color: transparent; clear: none; }

is bigger supposed to be an element or a class. if it's a class, it should be .bigger , right?

sheeks06
didn't think of that. Should be both.... a class to cover elements wrapped like this: <bigger></bigger>.You may be onto something though 'cause I had the page validated by w3w xhtml validator and one of the errors as described by MSDN involved an <bigger> being undeclared.I can't imagine why this would be an issue though if the code works in Chrome and Firefox.
Rosemary
Well, it depends on the doc type though. Chrome and Firefox is more forgiving in markups.http://www.w3schools.com/tags/tag_DOCTYPE.asp
sheeks06
My doctype used to be strict xhtml 1.0 until I validated the page and had errors returned about a frame. Then, I changed it to xhtml 1.0 transitional. This has made no difference. Any other suggestions would help.
Rosemary
Use other legal HTML tags like SPAN or DIV.
sheeks06
A: 

it looks like this: <a class="main" href="#"><img src="" /><bigger><img src="" /></bigger></a>

Don't do that.

The <bigger> element doesn't exist. You can't just make up your own elements, even in XHTML; not without creating a custom DTD anyway, which probably still wouldn't make it work in IE, since IE doesn't really support XHTML.

Chrome and Firefox are a bit more lenient in how they deal with unrecognized elements than IE8, which is why it works in those.

I would suggest you add a bigger class to the image instead: <img src="" class="bigger" /> and get rid of the <bigger> element.

mercator
Well...... tried creating an image class, works for Chrome and Firefox but not IE8 again. Visibility also fails. At this point, it may be in my interest to do without an image class. With one, IE8 doesn't fail 'gracefully' as some would say.
Rosemary
Tell me this though, i checked the rendered code in IE8 with developer tools and the bigger element is rendered nested within <a></a> as </bigger></bigger/>. Have also done more research and testing, Chrome and Firefox only replicate the IE8 error when bigger is declared as a class ie a.main.bigger. With this, visibility also fails in Chrome and Firefox.
Rosemary
This leads me to believe IE8 may simply be reading my element (not class) as a class of pseudo-element. Chrome and Firefox fail similarly when bigger is declared as a class or a pseudo-element like so: a.main.bigger or a.main::bigger.
Rosemary
@Rosemary, it should be `.main .bigger` (note the space before `.bigger`). Or was that what you were doing? If that doesn't fix it, please add a minimal working example (HTML + CSS) in your question or put it up online somewhere, because I don't think I can recreate the situation, so I have no idea what it's supposed to look like and in what way IE8 is failing. I don't think it's quite as mysterious as you make it out to be. IE8 just isn't applying the `bigger` styles...
mercator
well, i don't think i got the extra space in there. I wonder how that changes how IE8 renders the code. besides, I think there are issues with chrome and firefox applying Visibility and Positioning to classes. I guess doing what you've suggested will require changing my code considerably. I'll try but I was hoping for a simpler solution.
Rosemary
I've read about a few other solutions like a certain link to css.htc file which from what I gather, tells IE8 to behave a particular way. What do you think? Not my favorite solution but does have a certain simple charm.
Rosemary
You _need_ the extra space. `.main.bigger` selects elements with both classes `main` and `bigger`. `.main .bigger` selects elements with class `bigger` which are descendants of an element with class `main`. Or are you still trying to make it work with a `<bigger>` element? You don't need any .htc files of any kind. None of your CSS looks problematic for IE8 (let alone Firefox or Chrome), but you seem to have some misunderstandings about how HTML and CSS work. Again, though, I can't reproduce a working example, so I can't help you any further unless you provide more code.
mercator