maya90 — 2011-10-14T17:33:33-04:00 — #1
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...)
sdleihssirhc — 2011-10-14T18:15:56-04:00 — #2
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?
ralphm — 2011-10-14T19:28:28-04:00 — #3
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.
paulob — 2011-10-18T17:16:10-04:00 — #4
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..