Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using border-radius and box-shadow together (CSS)

Ok, I know neither of these properties are completely supported yet, but I'm using them anyway :P

When I add a border-radius and box-shadow (with and without vendor prefixes), the radius of the border-radius is not transparent to the box-shadow. Example: http://cndg.us/3f41a0

Is this possible to fix? I've also noticed that -webkit-box-shadow has some issues with hidden divs.

like image 484
Gary Avatar asked Apr 26 '10 15:04

Gary


People also ask

How do you add a box shadow to the border-radius?

CSS Demo: box-shadowIf a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).

Can we apply transform property to box shadow?

Using transforms on the box-shadow (& transform ) property, we can create the illusion of an element moving closer or further away from the user.


2 Answers

it is possible check here: http://jsfiddle.net/Zw4QA/1/

i think you have a element inside your div with the rounded corders. You have to apply the corners to this element to. At the moment rounded corners on the parent element will not apply to the children unless you specify it in your CSS.

for more CSS3 magic check this link: http://css3please.com/

Be aware that every single browser has his own way of handling Shadows and border radius http://thany.nl/apps/boxshadows/

like image 145
meo Avatar answered Sep 22 '22 06:09

meo


According to the documentation at MDN, a box-shadow automatically picks the border-radius of the element itself. Here is a link: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow#:~:text=The%20box%2Dshadow%20property%20enables,on%20the%20same%20rounded%20corners

like image 26
Daggie Blanqx - Douglas Mwangi Avatar answered Sep 24 '22 06:09

Daggie Blanqx - Douglas Mwangi