我已经创建了一个只使用HTML5和CSS3的饼图,它完美地工作。然而,问题是我做的馅饼太大了。麻烦让我的饼图更小
我想要的是馅饼约为当前大小的50%-75%。我应该怎么做?
这里是JSFiddle; LINK
HTML:
<body>
<div>
<div id="PieChartLeft">
<div class="pie"></div>
</div>
<div id="PieChartLeftValue">
<div class="pie"></div>
</div>
</div>
CSS:
.pie {
position:absolute;
width:200px;
height:200px;
clip:rect(0px,100px,200px,0px);
-moz-border-radius:100px;
-webkit-border-radius:100px;
border-radius:100px;
}
#PieChartLeft, #PieChartLeftValue {
-moz-transform:rotate(270deg);
-webkit-transform:rotate(270deg);
-o-transform:rotate(270deg);
transform:rotate(270deg);
position:absolute;
width:200px;
height:200px;
clip:rect(0px,200px,200px,100px);
left:300px;
}
#PieChartLeft .pie {
background-color:salmon;
border-color:salmon;
-moz-transform:rotate(180deg);
-webkit-transform:rotate(180deg);
-o-transform:rotate(180deg);
transform:rotate(180deg);
}
#PieChartLeftValue .pie {
background-color:grey;
border-color:grey;
-moz-transform:rotate(90deg);
-webkit-transform:rotate(90deg);
-o-transform:rotate(90deg);
transform:rotate(90deg);
}
您是否希望此功能得到响应?你可以调整值,或使用填充黑客。 – KreaTief 2014-10-31 09:11:04
@KreaTief,最好是。 – Yen 2014-10-31 09:11:30
好的,我会给你写一个demo,应该相当简单 – KreaTief 2014-10-31 09:12:06