I've been experimenting with CSS3 and found something strange. Heres's the part of DIV style:
border:#446429 solid 1px;
border-radius:15px;
-moz-border-radius:15px;
-webkit-border-radius:15px;
box-shadow:3px 0px 15px #000000 inset,0px 3px 15px #000000 inset;
-moz-box-shadow:3px 0px 15px #000000 inset,0px 3px 15px #000000 inset;
-webkit-box-shadow:3px 0px 15px #000000 inset,0px 3px 15px #000000 inset;
Rendering in Opera and Firefox are same and perfect:
But Chrome renders shadow outside the border:
Is it supposed to be so or I missed something important?
If there are contents within the div that has the curved corners, you have to set overflow: hidden because otherwise the child div's overflow can give the impression that the border-radius isn't working. This answer worked for me.
BROWSER SUPPORT FOR CSS3 Box-shadowCSS3 Box-shadow is supported by Chrome browser version 10 to Chrome browser version 67.
The box-shadow styles are used to pay attention to the content. Primer CSS Box Shadow Remove style is mainly used to remove the box-shadow. To remove the box-shadow, we will add an additional class . box-shadow-none.
The box-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the element, blur and spread radius, and color.
It looks like a known bug:
http://code.google.com/p/chromium/issues/detail?id=29427
Check out the bug discussion, you may find a workaround. Definitely Star this bug if you want it to be fixed sooner!
Putting in first an inset shadow that is the same colour as the background seems to work pretty well without putting extra markup on your page.
E.g. if you had a white background page :
-webkit-box-shadow:1px 1px 1px #fff inset,0px 0px 5px #333 inset;
I just found fix, but it needs additional markup. We need place element with round corners and inner shadow into another container with the same round corners and overflow hidden.
<div class="foo"><div>Hello!</div></div>
<style type="text/css">
.foo {-webkit-border-radius: 10px; overflow: hidden;}
.foo div {-webkit-border-radius: 10px; -webkit-box-shadow: inset 1px 1px rgba(50%, 50%, 50%, .5);}
</style>
Announced above fix with border crashes border radius and is incompartible with background image under element (because of border color).
Thanks.
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