Are Safari & Mobile Safari rendering rounded borders with radius and padding incorrectly?

此生再无相见时 提交于 2019-11-30 07:14:23

My bet it's Safari bug: border-radius is applied late and produces clipping effect. Fortunately, box-shadow is rendered correctly, so let's use it:

border-radius: 50%;
box-shadow:
  0 0 0 3px white,
  0 0 0 4px #999;

Works on Safari 6 on iPad and OS X.

Best solution I can think of right now: http://jsfiddle.net/ucNwx/5/

Uses a wrapper div to draw the border and then places the image inside of it. Still got some artifacts on the right edge but I guess that's a Safari bug.

HTML

<div class="border-container">
    <img src="http://lorempixel.com/200/200/animals/3/" />
</div>

CSS

.border-container {
    width: 206px;
    height: 206px;
    -webkit-border-radius: 50%;
    -moz-border-radius:    50%;
    border-radius:         50%;
    border: 1px solid #999;
    margin: 10px
}

img {
    -webkit-border-radius: 50%;
    -moz-border-radius:    50%;
    border-radius:         50%;
    width: 200px;
    height: 200px;
    margin: 3px;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!