fix bug and add 评分

This commit is contained in:
2024-05-11 11:43:33 +08:00
parent 40925e1ee6
commit 47ec7bbb12
3 changed files with 103 additions and 4 deletions
+99 -1
View File
@@ -41,11 +41,110 @@
background-color: antiquewhite;
}
</style>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/ionicons/4.5.6/css/ionicons.min.css'>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
}
.rating {
display: flex;
flex-direction: row-reverse; /* 子元素反向排列,最后一个在最前面 */
justify-content: flex-start; /* 子元素靠容器的左边对齐 */
font-family: "Ionicons";
}
.rating input {
opacity: 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.rating input:checked ~ label::before {
opacity: 1;
}
.rating label {
position: static;
margin-right: 6px;
font-size: 5em;
color: gold;
cursor: pointer;
transition: 0.5s;
}
.rating label:hover {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
.rating label::before {
position: absolute;
content: "\f384";
opacity: 0;
transition: 0.5s;
}
.rating label:hover::before, .rating label:hover ~ label::before {
opacity: 1 !important;
}
.rating:hover input:checked ~ label::before {
opacity: 0;
}
</style>
</head>
<body>
<div class="comment_post"> {# 提交评论区域的div #}
<div class="rating">
<h1>清晰性</h1>
<input type="radio" name="rating" id="5a" value="5" />
<label for="5a"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating" id="4a" value="4" />
<label for="4a"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating" id="3a" value="3" />
<label for="3a"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating" id="2a" value="2" />
<label for="2a"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating" id="1a" value="1" />
<label for="1a"><i class="icon ion-md-star-outline"></i></label>
</div>
<div class="rating">
<h1>准确性</h1>
<input type="radio" name="rating2" id="5b" value="5" />
<label for="5b"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating2" id="4b" value="4" />
<label for="4b"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating2" id="3b" value="3" />
<label for="3b"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating2" id="2b" value="2" />
<label for="2b"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating2" id="1b" value="1" />
<label for="1b"><i class="icon ion-md-star-outline"></i></label>
</div>
<div class="rating">
<h1>稳定性</h1>
<input type="radio" name="rating3" id="5c" value="5" />
<label for="5c"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating3" id="4c" value="4" />
<label for="4c"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating3" id="3c" value="3" />
<label for="3c"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating3" id="2c" value="2" />
<label for="2c"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating3" id="1c" value="1" />
<label for="1c"><i class="icon ion-md-star-outline"></i></label>
</div>
<div class="rating">
<h1>可靠性</h1>
<input type="radio" name="rating4" id="5d" value="5" />
<label for="5d"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating4" id="4d" value="4" />
<label for="4d"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating4" id="3d" value="3" />
<label for="3d"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating4" id="2d" value="2" />
<label for="2d"><i class="icon ion-md-star-outline"></i></label>
<input type="radio" name="rating4" id="1d" value="1" />
<label for="1d"><i class="icon ion-md-star-outline"></i></label>
</div>
<div id="commentform_title">发表评论</div>
<textarea rows="10" cols="60" id="comment_content"></textarea>
<p><button>提交评论</button></p>
@@ -102,6 +201,5 @@
})
</script>
</body>
</html>