How to apply box-shadow on all four sides?

后端 未结 10 1144
傲寒
傲寒 2020-12-13 05:47

I\'m trying to apply a box-shadow on all four sides. I could only get it on 2 sides:

\"\"

相关标签:
10条回答
  • 2020-12-13 05:50

    It's because of x and y offset. Try this:

    -webkit-box-shadow: 0 0 10px #fff;
            box-shadow: 0 0 10px #fff;
    

    edit (year later..): Made the answer more cross-browser, as requested in comments :)

    btw: there are many css3 generator nowadays.. css3.me, css3maker, css3generator etc...

    0 讨论(0)
  • 2020-12-13 05:50

    Just simple as this code:

    box-shadow: 0px 0px 2px 2px black; /*any color you want*/
    
    0 讨论(0)
  • 2020-12-13 05:55

    The most simple solution and easiest way is to add shadow for all four side. CSS

    box-shadow: 0 0 2px 2px #ccc; /* with blur shadow*/
    box-shadow: 0 0 0 2px #ccc; /* without blur shadow*/
    
    0 讨论(0)
  • 2020-12-13 05:56

    See: http://jsfiddle.net/thirtydot/cMNX2/8/

    input {
        -webkit-box-shadow: 0 0 5px 2px #fff;
        -moz-box-shadow: 0 0 5px 2px #fff;
        box-shadow: 0 0 5px 2px #fff;
    }
    
    0 讨论(0)
  • 2020-12-13 05:59

    Use this css code for all four sides: box-shadow: 0px 1px 7px 0px rgb(106, 111, 109);

    0 讨论(0)
  • 2020-12-13 06:03

    This looks cool.

    -moz-box-shadow: 0 0 5px #999;
    -webkit-box-shadow: 0 0 5px #999;
    box-shadow: 0 0 5px #999;
    
    0 讨论(0)
提交回复
热议问题