html - Parent inset box-shadow overlapped by children divs -
i having issue children divs overlapping parents box-shadow bottom.
the parent has max-height w/ overflow-y: scroll. great!
http://i.stack.imgur.com/jqe0r.png
html:
<div class="capture sh-btm"> <div class="threads"> <div class="thread"></div> <div class="thread"></div> <div class="thread"></div> <div class="thread"></div> </div> </div> css:
.capture { width: 100%; height: 100%; overflow-y: scroll; overflow-x: hidden; position: relative; } .threads { height: 250px; width: 100%; display: inline-block; padding-bottom: 10px; position: relative; clear: left; } .thread { width: 248px; float: left; margin-right: 8px; margin-top: 6px; border-bottom: 2px solid #dadada; overflow: hidden; zoom: 1; } .sh-btm { box-shadow: inset 0px -5px 9px -2px #000; }
no, you're asking can done quite easily. however, ease advise using background-image or css gradient instead of inset box-shadows. you'll have tweak css bit wanted. (for example make sure bottom overlay doesn't cover bottom arrow of scrollbar).
setting z-index on child elements work if have nothing more static text , images show, , no links or interactive content. you're not allowed set background parent, or hide children.
to achieve this, need make 2 separate shadow overlay divs, , position them absolutely in parent container. structure this:
- parent container
- shadow overlay left
- shadow overlay bottom
- threadcontainer (overflow set on div)
- thread
- thread
here working demo: http://jsbin.com/avafaq/1/edit
<div class="capture sh-btm"> <div id="shadow_overlay_left"></div> <div id="shadow_overlay_bottom"></div> <div class="threads"> <div class="thread"></div> <div class="thread"></div> </div> </div> #shadow_overlay_left{ width: 10px; height: 100%; position: absolute; z-index: 5; box-shadow: inset 3px -2px 5px 0px #000; } #shadow_overlay_bottom{ width: 100%; min-height: 10px; position: absolute; bottom: 0%; z-index: 5; box-shadow: inset 0px -5px 9px 0px #000; } .threads { overflow-y: scroll; overflow-x: hidden; } notice put overflow properties on .threads container instead of parent container. because else absolutely positioned divs scroll too, , not fill respective widths/ heights.
again, can apply box-shadow, background-image or css gradients shadow overlay divs.
Comments
Post a Comment