2015-10-06 44 views
1

我创建了一个简单的圆环图的小提琴:http://jsfiddle.net/4azpfk3r/217/CSS3圆环图

我怎样才能圆环图有一个红色的轮廓和填充是纯红色留下透明/红比分/百分比概述百分比部分没有得分?

CSS:

.background { 
    background: grey; 
} 

.item { 
    position: relative; 
    float: left; 
} 


.item h2 { 
    text-align:center; 
    position: absolute; 
    line-height: 125px; 
    width: 100%; 
} 


svg { 
    transform: rotate(-90deg); 
} 


.circle_animation { 
    stroke-dasharray: 440; 
    stroke-dashoffset: 440; 
} 


.html .circle_animation { 
    -webkit-animation: html 1s ease-out forwards; 
    animation: html 1s ease-out forwards; 
} 


.css .circle_animation { 
    -webkit-animation: css 1s ease-out forwards; 
    animation: css 1s ease-out forwards; 
} 


@-webkit-keyframes html { 
    to { 
     stroke-dashoffset: 80; 
    } 
} 


@keyframes html { 
    to { 
     stroke-dashoffset: 80; 
    } 
} 

回答

1

如果我正确地理解你的问题,尝试加入这一行的CSS:

#circle{fill:none;stroke:red;color:red}

对于得分类型也以红色,添加颜色property to the h2:

.item h2 { 
    text-align:center; 
    position: absolute; 
    line-height: 125px; 
    width: 100%; 
    color:red; /*ADD RED COLOR TO SCORE*/ 
} 

要设置Score标题的样式,首先给它一个类: <p class="scoreHeader">Score: 76/100</p>

和风格也如你所愿:

.scoreHeader{ 
    padding:10px; 
    background:red; 
    color:white; 
    font-weight:bold; 
} 
+0

好的,这使得线条变红......但是我希望得分为红色,而整个甜甜圈带有红色轮廓。 –

+0

@OamPsy你是说你想让这个圈子一路走来吗? – Mdalz

+0

@OamPsy如果它解决了你的问题,请接受答案=) – Mdalz