html - Child div behind parent div, how to fix link? -
i'm trying put child <div>
(with link in it) behind parent <div>
, links doesn't work.
i using z-index: -1
, maybe link being drawn "behind" <body>
.
is there way achive without breaking 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
alt text http://img832.imageshack.us/img832/8137/screenshot20100723at105.png
i spent half hour reading (very complex) css specs, i'm little bit confused positioned elements , stacking contexts. however, after fiddling around, found that
body { position: relative; z-index: 0; }
actually works! does
body { position: absolute; }
this turn body element new stocking context, meaning body (not html) serve canvas .back div.
Comments
Post a Comment