CSS五星评价

HTML:

<ul class="star-rating">
    <li><a href=’#’ title=’很差’ class=’one-star’>1</a></li>
    <li><a href=’#’ title=’较差’ class=’two-stars’>2</a></li>
    <li><a href=’#’ title=’还行’ class=’three-stars’>3</a></li>
    <li><a href=’#’ title=’推荐’ class=’four-stars’>4</a></li>
    <li><a href=’#’ title=’力荐’ class=’five-stars’>5</a></li>
</ul>

 

CSS:

 

#voteOpt {
    width: 240px;
    line-height: 33px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #E4F2FD;
    height: 35px;
}
/*             styles for the star rater                */
/*             styles for the star rater                */
.star-rating{
    list-style:none;
    margin: 0px;
    padding:0px;
    width: 150px;
    height: 33px;
    position: relative;
    background: url(../images/ratebar.gif) top left repeat-x;       
}
.star-rating li{
    padding:0px;
    margin:0px;
    /*\*/
    float: left;
    /* */
}
.star-rating li a{
    display:block;
    width:30px;
    height: 33px;
    text-decoration: none;
    text-indent: -9000px;
    z-index: 20;
    position: absolute;
    padding: 0px;
}
.star-rating li a:hover{
    background: url(../images/ratebar.gif) left bottom;
    z-index: 1;
    left: 0px;
}
.star-rating a.one-star{
    left: 0px;
}
.star-rating a.one-star:hover{
    width:30px;
}
.star-rating a.two-stars{
    left:30px;
}
.star-rating a.two-stars:hover{
    width: 60px;
}
.star-rating a.three-stars:hover{
    width: 90px;
}
.star-rating a.three-stars{
    left: 60px;
}
.star-rating a.four-stars{
    left: 90px;
}   
.star-rating a.four-stars:hover{
    width: 120px;
}
.star-rating a.five-stars{
    left: 120px;
}
.star-rating a.five-stars:hover{
    width: 150px;
}

Posted in html. 标签:. No Comments »