Skip to content Skip to sidebar Skip to footer

Border Shadow Issue

I am facing an issue to add a box-shadow only on left and right on multiple divs. I have tried this method already. This is an example of what I want, but it only works for a singl

Solution 1:

Like this?

FIDDLE

CSS

.main:before {
    box-shadow: -15px 0 15px -15px inset;
    content: " ";
    height: 100%;
    left: -15px;
    position: absolute;
    top: 0;
    width: 15px;
}
.main:after {
    box-shadow: 15px 0 15px -15px inset;
    content: " ";
    height: 100%;
    position: absolute;
    right: -15px;
    width: 15px;
}
.main {
    background: none repeat scroll 0 0 #EEEEEE;
    height: 100px;
    margin: 50px;
    position: relative;
    width: 100px;
}

Solution 2:

That's too much mess, why not try this? I just got rid of the :before and :after pseudo as well..

Demo

Demo 2 (Multiple elements)

div {
    background: none repeat scroll 0 0 #EEEEEE;
    height: 100px;
    margin: 50px;
    position: relative;
    width: 100px;
    box-shadow: 0 10px 0px 0px #eee, 
                0 -10px 0px 0px #eee, 
                10px 0 13px -5px rgba(0, 0, 0, 0.5), 
                -10px 0 13px -5px rgba(0, 0, 0, 0.5);
}

Solution 3:

Try this css

div{margin: 20px; width: 400px; height: 400px;
-webkit-box-shadow: 4px 2px  #222,  -4px 0 2px #222;   
-moz-box-shadow: 4px 0 2px #222,  -4px 0 2px #222;   
box-shadow: 4px 0 2px #222,  -4px 0 2px #222; 
}

JSFiddle


Post a Comment for "Border Shadow Issue"