how can you apply z-index to centered elements (z-index only works with positioned elements; positioned elements can't be centered... whether I center with margin:0 auto; or with text-align:center in containing element (body in my case); as soon as I apply position:relative; or position:absolute; it won't be centered anymore...)
It looks like there's more going on to mess up the centering than you explained. Here's a fiddle that shows a centered element can have position/z-index. Can you post the actual HTML/CSS, or link to a live example?
I second sdleihssirhc's comment that there is something else going on here. As sdleihssirhc's nice example shows, position: relative doesn't affect the element's centering at all.
No, as the others have said position:relative on its own will not affect centering at all (unlike position:absolute) and will allow the z-index to be applied..
This topic is now closed. New replies are no longer allowed.