09 April 2004
Z-index Is Killing Me
The other day, Adam Bramwell dropped me an email to let me know that there is/was an issue with my pop-ups that reside in my side bar. The pop-ups only worked in Firefox and such, but not in IE. This wasn't the problem. The problem was that I had put the content of the pop ups into a title attribute for IE visitors, and this meant that if you were using Firefox with a smaller resolution, you would get both, with one overlapping the other. A pain at best.
The thing is, I did know about this. Hasan mentioned it to me at the beginning of march. However, I had forgotten about it.
So, in a fast attempt to solve the problem I removed the title tags and tried to use javascript to simulate li:hover in IE. If you check out the blogroll in IE6 you will see that I have gotten part the way there. but not all the way.
For some reason the z-index of the pop-ups is not kicking in, and they are falling underneath everything else in IE. I don't know why, and I can't seem to work it out. Any suggestions?
- Time: 13:56
- Wubb Development
Comments ( 24 )
Hass
Phil Baines
A Fresh pair of eyes makes all the difference sometimes. But not on an empty stomach.
While your eating, I'm gonna go shower-up for a bit of socailising tonight.
Hass
Good luck with the ladies...
#container {z-index: 1}
.sidecol {z-index: 5}
I didn't save all your images to see if it totally works, but it's on the right track.
Hass
Oops
Phil Baines
the problem is that #maincol must have a z-index of 1 so that it is higher than the #sidecol
then the div in my <li> must have a z-index of 2 to put it above the #maincol. for this reason the #sidecol can not have a z-index.
it should work fine like this, but for some reason, doesn't in IE.
I'm off to see the 'ladies', as you so rightly put it. I stink of Burberry. ;o)
Phil Baines
PS
Hass
Warning: Don`t attempt on alcohol!
Would you consider having the pop-ups positioned to the right (out from under the main column background) instead of to the left? Might be easier than trying to debug the z-index thing!
Eric
So anything in it is still a child of an element which is underneath your maincol, and none of those children should be above. The spec says that z-indexes are relative to their parents; the parent of your flyouts is still sidecol, and the z-index is in relation to sidecol.
The parent of a z-index element sets up a new context for positioning where z=0. The children are all references to that (i.e. they will stack in the z-order you specify as long as they are siblings), but they will all have the parent's z-index with reference to othe page elements.
I don't know; I'm not an expert on z-index, but it looks like IE is doing the right thing and Mozilla is actually wrong. Please, correct me if I'm missing something here; I'd like it to work the way Mozilla does it, but it doesn't look like the spec does that.
Eric
So anything in it is still a child of an element which is underneath your maincol, and none of those children should be above. The spec says that z-indexes are relative to their parents; the parent of your flyouts is still sidecol, and the z-index is in relation to sidecol.
The parent of a z-index element sets up a new context for positioning where z=0. The children are all references to that (i.e. they will stack in the z-order you specify as long as they are siblings), but they will all have the parent's z-index with reference to othe page elements.
I don't know; I'm not an expert on z-index, but it looks like IE is doing the right thing and Mozilla is actually wrong. Please, correct me if I'm missing something here; I'd like it to work the way Mozilla does it, but it doesn't look like the spec does that.
eric
sorry
Hass
Eric
You could either set the sidebar to be on top and redo your background images/sizes to make it work, or you could just move the popups to fit in the visible portion. I can't really tell why you have the sidebar overlapping and underneath the maincontent anyway.
Phil Baines
Hass, I have move the posistioning of the pop-ups to the right for IE, so they will look ok at the moment. But I still want to work out why the z-index is not working. I tried giving the content container a specified z-index to get around what Eric said, but it still didn't work.
Using the right hand side position puts it off the screen for 800x600 IE users, and I don't want that.
Also, there was no love embraces last night :(
Maybe tonight will be better. :)
P L Schleuter
transitional
From what I have read, the use of transitional with the xhtml declaration, can cause IE into "quirks" mode.
I have been tasked to revise our webpages to conform to W3C standards using CSS and HTML. I haven't started on that project yet, since I still have a lot to learn.
I do like your site layout and the use of the pop-outs.
Eric
Phil, I wasn't suggesting you change the content container z-index...if I understand the spec correctly, you shouldn't be able to get the effect you want with CSS for this simple fact:
The sidebar is under the main column. The popouts are children of the sidebar. Therefore, the popouts are always under the main column.
I hope I am wrong, but I don't think you can have it both ways - if you don't want the sidebar to look funny when it's longer, how does the UA know that you want the popouts to overwrite your maincolumn? It doesn't really know that they're popouts - to the UA, they're just content, and content that it shouldn't be putting on top of the elements you have said are more important.
Eric
Hass
What about using the pop-ups for all but IE, and feeding "title" tooltips to IE? They won't be nifty semi-transparent, but they'll always be on top.
PL, DOCTYPEs, Quirks mode and much more are covered pretty thoroughly at positioniseverything.net ,check 'em out, they have good stuff.
Phil Baines
I'll check out PIE tomorrow when i'm working on wubbleyew
Phil Baines
I guess I am just hopinh Eric is wrong, and that it is possible. Time will tell.
p.s. Last night was better! :)
Hass
Phil Baines
If the #contentcontainer has no z-index, then giving the #maincol a z-index should not change the possibility of giving elements inside the #sidecol a higher z-index. because #maincol and #sidecol are parallel to each other in the tree. Or so I thought.
It may seem like I am taking an awfull long time about this, but the truth is I haven't been online that much this weekend. Easter weekend and all that. So I emagine I will be able to have a GOOD look at it tomorrow. Hopefully.
Eric
Again, we're all hoping I'm wrong...but I think you're gonna need to find another way to attach your background image if you want this to work.
Zoe
bad news
Phil Baines
I've been finding it hard to believe because I have never come across Firefox getting something this wrong before. It sure is strange.
The thing is, I cant reposition the background images in any way, because they flow with the content of #maincol and #sidecol, thus they must be attached to the div’s holding the content.
What I want to do now, is to have the pop-ups positioned within the #sidecol, and places on top of everything inside the #sidecol. This should be possible now, I thought, because I am not trying to get it on top of the #maincol.
But still for some reason, IE is having problems with this.
I've only just woken up, and I’m feeling rather ill today after a weekend of 'activities', so I probably wont be able to test till this evening.
Sorry, commenting has been disabled for a while. I am getting a stupid amount of comment spam, and need to find a new way of doing things.
I will not publish your email address, but I may use it to get in contact with you.
HTML tags and entities display as source; they do not render. To create a live link, simply type the URL (including http://).