2015-10-06 43 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