CSS Box Shadow Bottom Only

This question already has an answer here:

  • drop shadow only bottom css3 10 answers

  • Do this:

    box-shadow: 0 4px 2px -2px gray;
    

    its actually much simpler, what ever you set the blur to (3rd value), set the spread (4th value) to the negative of it.


    You can use two elements, one inside the other, and give the outer one overflow: hidden and a width equal to the inner element together with a bottom padding so that the shadow on all the other sides are "cut off"

    #outer {
        width: 100px;
        overflow: hidden;
        padding-bottom: 10px;
    }
    
    #outer > div {
        width: 100px;
        height: 100px;
        background: orange;
    
        -moz-box-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
        -webkit-box-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
        box-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
    }
    

    Alternatively, float the outer element to cause it to shrink to the size of the inner element. See: http://jsfiddle.net/QJPd5/1/


    Try this

    -moz-box-shadow:0 5px 5px rgba(182, 182, 182, 0.75);
    -webkit-box-shadow: 0 5px 5px rgba(182, 182, 182, 0.75);
    box-shadow: 0 5px 5px rgba(182, 182, 182, 0.75);
    

    You can see it in http://jsfiddle.net/wJ7qp/

    链接地址: http://www.djcxy.com/p/89038.html

    上一篇: 阴影在一个元素的一侧?

    下一篇: CSS Box Shadow仅限底部