开发者

Convert CSS border-radius % values to px dynamically

开发者 https://www.devze.com 2023-02-19 14:32 出处:网络
My CSS has a class circle that contains border-radius: 50%. Unfortunately, some browsers don\'t support开发者_StackOverflow中文版 the %, and render the circle as a square. I want to dynamically conver

My CSS has a class circle that contains border-radius: 50%. Unfortunately, some browsers don't support开发者_StackOverflow中文版 the %, and render the circle as a square. I want to dynamically convert the percentages to pixel values for browsers that don't support the percentages.

How can I accomplish this with JavaScript / jQuery?


$('#circle').css("border-radius",$('#circle').width()/2);

See the example http://jsfiddle.net/cZqQ8/

Apparently you should use -moz-border-radius to work with mozilla


Try this dude :

$('.circle').css("border-radius",$('.circle').width()/2);
0

精彩评论

暂无评论...
验证码 换一张
取 消