Scaled container won't keep round shape (border
I have a simple round-shaped container:
.foo {
width: 5px;
height: 5px;
background-color: green;
border-radius: 50%;
}
When I try to scale its size with:
.foo {
-webkit-transform: scale(10,10);
transform: scale(10,10);
}
It doesn't look that round anymore. Seems like its border-radius gets a value equal to the original border radius in pixels multiplied by the scale value.
https://jsfiddle.net/h70wsqrv/1/
Any ideas how to fix it?
UPDATE: Seems like the problem only occurs in Chrome. Firefox shows a perfect circle.
Strange, but it works if you set width and height to 6px
or any even number .
Looks like radius is calculated wrong in Chrome when it is an odd number.
.foo {
margin: 100px;
width: 6px;
height: 6px;
background-color: green;
border-radius: 50%;
-webkit-transform: scale(15, 15);
transform: scale(15, 15);
}
<div class="foo">
</div>
链接地址: http://www.djcxy.com/p/89204.html
上一篇: 尝试语句语法
下一篇: 缩放容器不会保持圆形(边框