I'm trying to put a child <div>
(with a link in it) behind its parent <div>
, but the links doesn't work.
I am using z-index: -1
, so maybe the link is being drawn "behind" the <body>
.
Is there a way to achive this without breaking the link?
Thanks
The CSS
.front {
width: 200px;
height: 200px;
background: #EA7600;
-moz-box-shadow: 5px 5px 5px rgba(0,0,0,0.3);
-webkit-box-shadow: 5px 5px 5px rgba(0,0,0,0.3);
box-shadow: 5px 5px 5px rgba(0,0,0,0.3);
}
.back {
width: 300px; height: 50px; background: #93CDFB;
position: absolute;
left: 100px;
text-align: right;
padding: 5px;
}
The HTML
<div class="front">
<div class="back">
<a href="http://www.stackoverflow.com">This link works</a>
</div>
</div>
<div class="front" style="z-index: 1">
<div class="back" style="z-index: -1">
<a href="http://www.stackoverflow.com">This link doesn't work</a>
</div>
</div>
The Result