在这种情况下,我如何将这两个评级栏分离为css php html



查看代码并运行它,我在同一页面中有两个条形图评级。正如你所看到的,第二个酒吧评级和第一个酒吧评级搞砸了,我怎么能把它们分开呢。我试着分配不同的id,尝试不同的类,也失败了。我能做什么?欣赏

.rating {
    float:left;
}
   
.rating:not(:checked) > input {
    position:absolute;
    left:-9999px;
    clip:rect(0,0,0,0);
}
#rating_1:not(:checked) > label {
    float:right;
    width:9px;
	padding:0 .1em 0 0;
	border-left:.1em solid #fff;/* make space between content*/
	overflow:hidden;
    white-space:nowrap;
    cursor:pointer;
    font-size:200%;
    line-height:0.9;
    text-shadow:1px 1px #bbb, 2px 2px #666, .1em .1em .2em rgba(0,0,0,.5);
}
#rating_1:not(:checked) > label:before {
    content:'0a0 0a0 0a0 ';
    background-color: #c7c5c5;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    border-radius: 1px;	
}
#rating_1 > input:checked ~ label:before {
	content:'0a0 0a0 0a0 ';
	background-color: #4bce32;
}
#rating_1:not(:checked) :hover ~ label:before {
content:'0a0 0a0 0a0 ';
background-color: #4bce32;
}
/* second rating*/
#diet_voting #rating_2:not(:checked) > label {
    float:right;
    width:9px;
	padding:0 .1em 0 0;
	border-left:.1em solid #fff;/* make space between content*/
	overflow:hidden;
    white-space:nowrap;
    cursor:pointer;
    font-size:200%;
    line-height:0.9;
    text-shadow:1px 1px #bbb, 2px 2px #666, .1em .1em .2em rgba(0,0,0,.5);
}
#diet_voting #rating_2:not(:checked) > label:before {
    content:'0a0 0a0 0a0 ';
    background-color: #c7c5c5;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    border-radius: 1px;	
}
#diet_voting #rating_2 > input:checked ~ label:before {
	content:'0a0 0a0 0a0 ';
	background-color: #4bce32;
}
#diet_voting #rating_2:not(:checked) :hover ~ label:before {
content:'0a0 0a0 0a0 ';
background-color: #4bce32;
}
<div class="user_voting" id="faith_voting">		
		<fieldset class="rating" id="rating_1">
		    <legend>Effective:</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>	  
		</div>
	<div class="user_voting" id="diet_voting">
		<fieldset class="rating" id="rating_2">
		    <legend>Effective:</legend>
		    <input type="radio" id="star5_2" name="rating_2" value="5" /><label for="star5" title="Rocks!">5 stars</label>
		    <input type="radio" id="star4_2" name="rating_2" value="4" /><label for="star4" title="Pretty good">4 stars</label>
		    <input type="radio" id="star3_2" name="rating_2" value="3" /><label for="star3" title="Meh">3 stars</label>
		    <input type="radio" id="star2_2" name="rating_2" value="2" /><label for="star2" title="Kinda bad">2 stars</label>
		    <input type="radio" id="star1_2" name="rating_2" value="1" /><label for="star1" title="Sucks big time">1 star</label>
		</fieldset>
      </div>

.rating {
    float:left;
}
   
.rating:not(:checked) > input {
    position:absolute;
    left:-9999px;
    clip:rect(0,0,0,0);
}
#rating_1:not(:checked) > label {
    float:right;
    width:9px;
	padding:0 .1em 0 0;
	border-left:.1em solid #fff;/* make space between content*/
	overflow:hidden;
    white-space:nowrap;
    cursor:pointer;
    font-size:200%;
    line-height:0.9;
    text-shadow:1px 1px #bbb, 2px 2px #666, .1em .1em .2em rgba(0,0,0,.5);
}
#rating_1:not(:checked) > label:before {
    content:'0a0 0a0 0a0 ';
    background-color: #c7c5c5;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    border-radius: 1px;	
}
#rating_1 > input:checked ~ label:before {
	content:'0a0 0a0 0a0 ';
	background-color: #4bce32;
}
#rating_1:not(:checked) :hover ~ label:before {
content:'0a0 0a0 0a0 ';
background-color: #4bce32;
}
/* second rating*/
#diet_voting #rating_2:not(:checked) > label {
    float:right;
    width:9px;
	padding:0 .1em 0 0;
	border-left:.1em solid #fff;/* make space between content*/
	overflow:hidden;
    white-space:nowrap;
    cursor:pointer;
    font-size:200%;
    line-height:0.9;
    text-shadow:1px 1px #bbb, 2px 2px #666, .1em .1em .2em rgba(0,0,0,.5);
}
#diet_voting #rating_2:not(:checked) > label:before {
    content:'0a0 0a0 0a0 ';
    background-color: #c7c5c5;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    border-radius: 1px;	
}
#diet_voting #rating_2 > input:checked ~ label:before {
	content:'0a0 0a0 0a0 ';
	background-color: #4bce32;
}
#diet_voting #rating_2:not(:checked) :hover ~ label:before {
content:'0a0 0a0 0a0 ';
background-color: #4bce32;
}
<div class="user_voting" id="faith_voting">		
		<fieldset class="rating" id="rating_1">
		    <legend>Effective:</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>	  
		</div>
	<div class="user_voting" id="diet_voting">
		<fieldset class="rating" id="rating_2">
		    <legend>Effective:</legend>
		    <input type="radio" id="star5_2" name="rating_2" value="5" /><label for="star5_2" title="Rocks!">5 stars</label>
		    <input type="radio" id="star4_2" name="rating_2" value="4" /><label for="star4_2" title="Pretty good">4 stars</label>
		    <input type="radio" id="star3_2" name="rating_2" value="3" /><label for="star3_2" title="Meh">3 stars</label>
		    <input type="radio" id="star2_2" name="rating_2" value="2" /><label for="star2_2" title="Kinda bad">2 stars</label>
		    <input type="radio" id="star1_2" name="rating_2" value="1" /><label for="star1_2" title="Sucks big time">1 star</label>
		</fieldset>
      </div>

最新更新