我的评级星系统出现了问题,即使用纯CSS。我的问题是,当我使用箭头键选择星星时...它是向后的。我必须使用左箭头键向右或向右箭头键向左移动。我试过玩漂浮物,但它没有帮助。我也尝试重新排列标记,但我也有类似的结果。
.rating {
float: left;
}
.rating:not(:checked)>input {
position: absolute;
top: -9999px;
clip: rect(0, 0, 0, 0);
}
.rating:not(:checked)>label {
float: right;
width: 1em;
padding: 0 .1em;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
font-size: 200%;
line-height: 1.2;
color: #ddd;
text-shadow: 1px 1px #bbb, 2px 2px #666, .1em .1em .2em rgba(0, 0, 0, .5);
}
.rating:not(:checked)>label:before {
content: '★ ';
}
.rating>input:checked~label {
color: #f70;
text-shadow: 1px 1px #c60, 2px 2px #940, .1em .1em .2em rgba(0, 0, 0, .5);
}
.rating:not(:checked)>label:hover,
.rating:not(:checked)>label:hover~label {
color: gold;
text-shadow: 1px 1px goldenrod, 2px 2px #B57340, .1em .1em .2em rgba(0, 0, 0, .5);
}
.rating>input:checked+label:hover,
.rating>input:checked+label:hover~label,
.rating>input:checked~label:hover,
.rating>input:checked~label:hover~label,
.rating>label:hover~input:checked~label {
color: #ea0;
text-shadow: 1px 1px goldenrod, 2px 2px #B57340, .1em .1em .2em rgba(0, 0, 0, .5);
}
.rating>label:active {
position: relative;
top: 2px;
left: 2px;
}

<fieldset class="rating">
<legend>Please rate:</legend>
<input type="radio" id="star5" name="rating" value="5" /><label for="star5" title="Rocks!">5 stars</label>
<input type="radio" id="star4" name="rating" value="4" /><label for="star4" title="Pretty good">4 stars</label>
<input type="radio" id="star3" name="rating" value="3" /><label for="star3" title="Meh">3 stars</label>
<input type="radio" id="star2" name="rating" value="2" /><label for="star2" title="Kinda bad">2 stars</label>
<input type="radio" id="star1" name="rating" value="1" /><label for="star1" title="Sucks big time">1 star</label>
</fieldset>
&#13;