title: CSS 5 star rating System, star span issue
body: <p>I have created a 5 star rating system. My css is set up to display grey background stars which are fixed on the screen. When hovered over blue stars appear, although these stars are centered and span out, for example when I select 1 star, the middle star turns gold instead of the left most grey star, likewise if I select 2 stars, two gold stars appear between the second and fourth grey stars, with the grey stars still visable in the background. This looks very untidy.</p>
  
  <p>Can anyone advise how I can change my code to turn the actual stars that is selected gold?</p>
  
  <p>My stars image is stars.png which has a grey, blue and gold star respectively in one image.</p>
  
  <p>My knowledge of css is limited. I have tried changing multiple components of the css one by one such as width or px but to no avail.</p>
  
  <p>Here is my css.</p>
  
  <pre><code>form .stars {
    background: url("stars.png") repeat-x 0 0;
    width: 150px;
    margin: 0 auto;
  }
  
  form .stars input[type="radio"] {
    position: absolute;
    opacity: 0;
    filter: alpha(opacity=0);
  }
  form .stars input[type="radio"].star-5:checked ~ span {
    width: 100%;
  }
  form .stars input[type="radio"].star-4:checked ~ span {
    width: 80%;
  }
  form .stars input[type="radio"].star-3:checked ~ span {
    width: 60%;
  }
  form .stars input[type="radio"].star-2:checked ~ span {
    width: 40%;
  }
  form .stars input[type="radio"].star-1:checked ~ span {
    width: 20%;
  }
  form .stars label {
    display: block;
    width: 30px;
    height: 30px;
    margin: 0!important;
    padding: 0!important;
    text-indent: -999em;
    float: left;
    position: relative;
    z-index: 10;
    background: transparent!important;
    cursor: pointer;
  }
  form .stars label:hover ~ span {
    background-position: 0 -30px;
  }
  form .stars label.star-5:hover ~ span {
    width: 100% !important;
  }
  form .stars label.star-4:hover ~ span {
    width: 80% !important;
  }
  form .stars label.star-3:hover ~ span {
    width: 60% !important;
  }
  form .stars label.star-2:hover ~ span {
    width: 40% !important;
  }
  form .stars label.star-1:hover ~ span {
    width: 20% !important;
  }
  form .stars span {
    display: block;
    width: 0;
    position: relative;
    top: 0;
    left: 0;
    height: 30px;
    background: url("stars.png") repeat-x 0 -60px;
    -webkit-transition: -webkit-width 0.5s;
    -moz-transition: -moz-width 0.5s;
    -ms-transition: -ms-width 0.5s;
    -o-transition: -o-width 0.5s;
    transition: width 0.5s;
  }
  </code></pre>