내가 올려 놓은 별의 양을 표시하는 5 성급 시스템을 만들려고합니다.스타 등급 시스템 용 CSS
배경이 5 개이고 그 앞에 5 개의 다른 색깔의 별이있는 똑같은 모양의 div가 있습니다.이 div의 너비는 기본적으로 0입니다.
사람이 너비의 커서를 움직이면 두 번째 배경이 너비를 적절하게 조정하여 나타납니다.
나는이 동작하지 않습니다이 내 바이올린입니다 : http://jsfiddle.net/AAgU9/
내 HTML은 다음과 같습니다
<div style="position:relative">
<div class="stb"></div>
<div class="stf"></div>
<div class="sts st1"></div>
<div class="sts st2"></div>
<div class="sts st3"></div>
<div class="sts st4"></div>
<div class="sts st5"></div>
</div>
내 CSS입니다 : 내가 잘못 뭐하는 거지
.stb{
background:red;
width:140px;
height:27px;
cursor:pointer}
.stf{
position:absolute;
width:0;
height:27px;
top:0;
left:0;
background:green 0 -26px;
cursor:pointer}
.sts{
position:absolute;
width:28px;
height:27px;
top:0;
cursor:pointer;
z-index:2}
.st1{left:0}
.st2{left:28px}
.st3{left:56px}
.st4{left:84px}
.st5{left:112px}
.st1:hover .stf{background:red}
.st2:hover .stf{width:56px}
.st3:hover .stf{width:84px}
.st4:hover .stf{width:112px}
.st5:hover .stf{width:140px}
?
.st5 : 타겟으로 .STF를 가져 div.st5의 자손 div.stf이지만 stf는 실제로 st5의 형제입니다. – Andrew
'.st1 : hover .stf' 외 ...'.st1'의 자식이 없습니다. 어떻게 그 규칙을 사용할 수 있습니까? – Ming
이것 좀보세요 : http://css-tricks.com/examples/StarRating/ – Andrew