1

I am trying to create Rating circles like:-

enter image description here

I have tried many techniques like circle within circle, or circle at the top of each other with different z-index and width in %. But I'm having no luck.

What will be the best way to implement this in CSS or JavaScript with using any image.

3

1 Answer 1

4

By way of a starting point, have a look at:

Demo Fiddle

HTML

<div class='circle'></div>
<div class='circle25'></div>
<div class='circle50'></div>
<div class='circle75'></div>
<div class='circle100'></div>

CSS

div[class^=circle] {
    background:white;
    border-radius:100%;
    display:inline-block;
    height:20px;
    width:20px;
    overflow:hidden;
    position:relative;
}
div[class^=circle]:after {
    content:'';
    position:absolute;
    display:block;
    height:100%;
    left:0;
    background:orange;
}
div.circle25:after {
    width:25%;
}
div.circle50:after {
    width:50%;
}
div.circle75:after {
    width:75%;
}
div.circle100:after {
    width:100%;
}
1
  • I'd suggest to do it vice versa, i.e. make the after part orange to avoid artifacts on the border. Commented Apr 8, 2014 at 14:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.