z-index
only works for a position
that is not the default static
. So by setting it to relative
, you will achieve your effect.
Here's a JSFiddle http://jsfiddle.net/DKpGA/2/
Note that specifying position:relative
without top
,bottom
,left
, or right
attributes will usually not move your element and ruin the layout, however absolute
removes it from the natural flow and puts it outside of other element's scopes, so be careful with it.