simple 5 star rating system with css and html radios

Solutions on MaxInterview for simple 5 star rating system with css and html radios by the best coders in the world

showing results for - "simple 5 star rating system with css and html radios"
Hannes
23 Aug 2019
1<html>
2  <head>
3<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
4    <style>
5    	div.stars {
6  width: 270px;
7  display: inline-block;
8}
9
10input.star { display: none; }
11
12label.star {
13  float: right;
14  padding: 10px;
15  font-size: 36px;
16  color: #444;
17  transition: all .2s;
18}
19
20input.star:checked ~ label.star:before {
21  content: '\f005';
22  color: #FD4;
23  transition: all .25s;
24}
25
26input.star-5:checked ~ label.star:before {
27  color: #FE7;
28  text-shadow: 0 0 20px #952;
29}
30
31input.star-1:checked ~ label.star:before { color: #F62; }
32
33label.star:hover { transform: rotate(-15deg) scale(1.3); }
34
35label.star:before {
36  content: '\f006';
37  font-family: FontAwesome;
38}
39    </style>
40</head>
41  <body>
42  <div class="stars">
43  <form action="">
44    <input class="star star-5" id="star-5" type="radio" name="star"/>
45    <label class="star star-5" for="star-5"></label>
46    <input class="star star-4" id="star-4" type="radio" name="star"/>
47    <label class="star star-4" for="star-4"></label>
48    <input class="star star-3" id="star-3" type="radio" name="star"/>
49    <label class="star star-3" for="star-3"></label>
50    <input class="star star-2" id="star-2" type="radio" name="star"/>
51    <label class="star star-2" for="star-2"></label>
52    <input class="star star-1" id="star-1" type="radio" name="star"/>
53    <label class="star star-1" for="star-1"></label>
54  </form>
55</div>
56    </body>
57</html>