Box shade only on 3 sides

I have two overlapping divs that have css3 shadows. The problem is that even when I set the z-index, I still need to remove one of the div tags. I've seen cases where negative spreads and zero values ​​are used, but I don't think it would work here.

Now I have the code:

#bulb-top {
    position: relative;
    width: 280px;
    height: 280px;
    background-color: #E5F7A3;
    -webkit-border-radius: 280px;
    -moz-border-radius: 280px;
    border-radius: 280px;
    border: 8px solid #FFF40C;
    top: -430px;
    margin-left: auto;
    margin-right: auto;
    -webkit-box-shadow: 0px 0px 15px 1px #FFF40C;
    -moz-box-shadow: 0px 0px 15px 1px #FFF40C;
    box-shadow: 0px 0px 15px 1px #FFF40C;
    z-index: 4;
}

#bulb-bottom {
    position: relative;
    width: 140px;
    height: 120px;
    background-color: #E5F7A3;
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -moz-border-radius-bottomright: 30px;
    -moz-border-radius-bottomleft: 30px;
    -webkit-border-radius: 0px 0px 30px 30px;
    border-radius: 0px 0px 30px 30px;
    border-left: 8px solid #FFF40C;
    border-right: 8px solid #FFF40C;
    border-bottom: 8px solid #FFF40C;
    top: -455px;
    margin-left: auto;
    margin-right: auto;
    -webkit-box-shadow: 0px 0px 15px 1px #FFF40C;
    -moz-box-shadow: 0px 0px 15px 1px #FFF40C;
    box-shadow: 0px 0px 15px 1px #FFF40C;
    z-index: 5;
}

      

http://jsfiddle.net/minitech/g42vq/3/

+3


source to share


1 answer


You can use a pseudo element ::before

to block one side of the window shadow. It's not ideal, but it might be enough for your situation. Here's an updated jsFiddle.



#bulb-bottom:before {
    background-color: #E5F7A3;
    content: '';
    display: block;
    height: 30px;
    margin: 0 auto;
    position: relative;
    top: -10px;
    width: 140px;
}​

      

+5


source







All Articles