可以呀。
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>css 12等分圆</title>
</head>
<style type="text/css">
.container {
position: relative
width: 200px
height: 200px
overflow: hidden
border: 2px outset deeppink
border-radius: 50%
margin:5em auto
}
.layer {
position: absolute
transform-origin: left top
left: 100px
top: 100px
width: 100px
height: 100px
border: 1px solid white
box-sizing: border-box
}
</style>
<script type="text/javascript">
onload = function () {
[].slice.call(document.querySelectorAll('.layer'), 0).forEach(function (item, i) {
item.style.backgroundColor = '#' + (~~(Math.random() * (1 << 24))).toString(16)
item.style.transform = 'rotate(' + 360 / 12 * (i + 1) + 'deg)skewX(60deg)'
})
}
</script>
<body>
<div class="container">
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
<div class="layer"></div>
</div>
</body>
</html>
可以使用 DrawArc 方法来实现有间隔的圆。这个方法需要提供七个参数:左上角 X 坐标、左上角 Y 坐标、右下角 X 坐标、右下角 Y 坐标、开始弧度、结束弧度、是否使用顺时针绘制(true 为顺时针)。<div style="width:100pxheight:100pxborder-radius:50%overflow:hidden"><img src="">
</div>
需要浏览器支持CSS 3 ,注意div的宽高要一样,也可以直接把样式添加在img上,但不建议那样