I have this class here and I using box-shadow which works fine, but it only shows the shadow on 2 sides, is there away to get the shadow on all four sides?
Thanks, J
.contactBackground{
background-color:#FFF;
padding:20px;
box-shadow: 10px 10px 10px #000000;
}
If you set the offsets to zero, the shadow will be equal on all four sides.
The CSS code would be: box-shadow: 0 0 10px 5px white; That will shadow the entire DIV no matter its shape! Save this answer.
To add more than one shadow to the text, you can add a comma-separated list of shadows.
If you set the offsets to zero, the shadow will be equal on all four sides.
.contactBackground{
background-color:#FFF;
padding:20px;
box-shadow: 0 0 10px #000000;
}
CSS3 box-shadow property has following attributes: (W3Schools)
box-shadow: h-shadow v-shadow blur spread color inset;
In your example you're offsetting shadow by 10px vertically and horizontally.
Like in other comments set first two values to 0px in order to have even shadow on all sides.
The main prefix for shadow to support latest browsers is box-shadow
.
There are 2 other ones that I recommend to use for older Mozilla and Webkit:
-moz-box-shadow
-webkit-box-shadow
Also, by using rgba
instead of hex color value you can set the alpha/opacity of the shadow:
box-shadow: 0px 0px 20px 10px rgba(0, 0, 0, 0.3);
Remove the offset definitions, and use only the blur radius (the third argument):
.contactBackground{
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px #000;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With