私は純粋なCSSの星評価システムを見つけましたが、与えられたコードではページごとに1つのスターシステムしか使用できません。私はクラス名を変更しようとしましたが、残念なことに2番目の星評価フォームは、最初の星評価フォームを押したときにチェックします。これを回避する方法はありますか?1つのラジオフォームが別のラジオフォームを確認しないようにする方法
.rating {
border: none;
float: left;
}
.rating > input { display: none; }
.rating > label:before {
margin: 5px;
font-size: 1.25em;
font-family: FontAwesome;
display: inline-block;
content: "\f005";
}
.rating > .half:before {
content: "\f089";
position: absolute;
}
.rating > label {
color: #ddd;
float: right;
}
/***** CSS Magic to Highlight Stars on Hover *****/
.rating > input:checked ~ label, /* show gold star when clicked */
.rating:not(:checked) > label:hover, /* hover current star */
.rating:not(:checked) > label:hover ~ label { color: #FFD700; } /* hover previous stars in list */
.rating > input:checked + label:hover, /* hover current star when changing rating */
.rating > input:checked ~ label:hover,
.rating > label:hover ~ input:checked ~ label, /* lighten current selection */
.rating > input:checked ~ label:hover ~ label { color: #FFED85; }
あなたは、このようにHTML
<form class="form-class" id="starform">
<fieldset class="rating">
<input type="radio" id="star2" name="rating" value="2"/>
<label class="full" for="star2" title="2 stars"></label>
<input type="radio" id="star1" name="rating" value="1"/>
<label class="full" for="star1" title="1 star"></label>
</fieldset>
</form>
<form class="form-class" id="starformtwo">
<fieldset class="ratingtwo">
<input type="radio" id="star2-2" name="ratingtwo" value="2"/>
<label class="full" for="star2-2" title="2 stars"></label>
<input type="radio" id="star1-2" name="ratingtwo" value="1"/>
<label class="full" for="star1-2" title="1 star"></label>
</fieldset>
</form>
あなたのすべてのCSSセレクタは 'ratings'を参照していますが、あなたの要素のどのクラスもそのクラスを持っていません – j08691
申し訳ありませんが間違いでした – Billy