Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

border-radius fails under safari (ugly clipping)

Tags:

html

css

safari

Does anybody know a workaround for folowing 'bug' in Safari?

When I use border-radius to create rounded borders in CSS3 it just works fine on Safari, FF and so on.

But when the border-color is the color like in the background you can see the containers background overlapping the border.

You can try it here: http://de.roundedcorner.org/css3-rounded-corner-generator Just set the border-color and sites background to #333333

Thanks for your help!

like image 429
Gundon Avatar asked Mar 06 '11 11:03

Gundon


2 Answers

That's most likely due to background clipping.

The following should correct that.

-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;

For some more on background-clip, have a look here: https://developer.mozilla.org/en/CSS/background-clip

like image 147
Quiche_on_a_leash Avatar answered Nov 08 '22 03:11

Quiche_on_a_leash


The background-clip property is used to determine whether the backgrounds extends into the border or not. The default is border-box, which means it DOES extend into it, but if you set it to padding-box, it doesn’t. if you use content-box the background only extends to the content area. (source: http://www.css3.info/preview/background-origin-and-background-clip/)

Solution for your problem is to use: -webkit-background-clip: padding-box;

It’s important to note that if you are using the shorthand notation to specify your other background properties then this should be added after those. It seems that the shorthand notation implies a default clip value which will override one that’s previously set. (source: http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleed)

like image 2
Pavot Avatar answered Nov 08 '22 02:11

Pavot