Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Box-shadow over next sibling div

Tags:

html

css

I have a box shadow on a div that i want to stick out like a bar over the next div on the page, but when the next div has a background or background image, it won't show up. is there a way of the shadow showing over the next element even though they are both "position:initial;" http://jsfiddle.net/2u4Lvyn0/2/ so the shadow should overlook the blue box below it

HMTL

<div class="background-image-div"></div>
<div class="box-shadow-div"></div>
<div class="background-image-div"></div>

CSS

.box-shadow-div{
    height:100px;
    background:orange;
    -webkit-box-shadow: 0px 3px 3px 15px rgba(0,0,0,1);
    -moz-box-shadow: 0px 3px 3px 15px rgba(0,0,0,1);
    box-shadow: 0px 3px 3px 15px rgba(0,0,0,1);
}

.background-image-div{
    height:100px;
    background:blue;
    border:1px solid yellow;
}

I've seen a lot of posts on 'inset box-shadow' not working with it's own divs background image but couldn't find anything about just regular sibling divs.

like image 752
MintWelsh Avatar asked Jul 07 '15 18:07

MintWelsh


1 Answers

Adding position:relative; will fix it. Though, it may affect other CSS tweaks you already have.

http://jsfiddle.net/2u4Lvyn0/5/

like image 188
KidBilly Avatar answered Sep 27 '22 21:09

KidBilly