2012-07-15 52 views

回答

2

這裏,http://jsfiddle.net/JDRSc/7/

HTML

<div id="wrapper"> 
    <img src="http://kittens-for-sale.net/wp-content/uploads/2011/11/kittens-for-sale-5.jpg" alt="" /> 
</div> 

CSS

#wrapper { 
    display:inline-block; 
    border: 10px solid black; 
    -moz-border-radius: 30px; /*Sum of #wrapper border + img border-radius*/ 
    -webkit-border-radius: 30px; /*Sum of #wrapper border + img border-radius*/ 
    border-radius: 30px; /*Sum of #wrapper border + img border-radius*/ 
}  

img { 
    display: block; 
    -moz-border-radius: 20px; 
    -webkit-border-radius: 20px; 
    border-radius: 20px; 
}​ 
0

要管理邊界半徑在內部和外部生效,您應該給邊界半徑的值大於邊界大小。

這將解決這個問題。

嘗試:

border-size:10px; 
border-radius:15px; 

它會奏效。

+0

謝謝,但怎麼來的,這是不工作? http://jsfiddle.net/JDRSc/1/ – dangerChihuahua007 2012-07-15 07:30:10

+0

好了,我找不到有關還沒有任何文件或引用..但它是一個數學問題。當半徑爲20時,半徑的中心將爲20px。這意味着該中心不會被四捨五入。這裏有些東西可能會解釋一些:http://www.w3.org/TR/css3-background/#the-border-radius – 2012-07-15 07:36:06

+0

這不行! – abhshkdz 2012-07-15 07:39:42