<h1>Star Rating</h1>
<div class="rating">
<input type="radio" name="rating" id="r-1">
<label for="r-1"></label>
<input type="radio" name="rating" id="r-2">
<label for="r-2"></label>
<input type="radio" name="rating" id="r-3">
<label for="r-3"></label>
<input type="radio" name="rating" id="r-4">
<label for="r-4"></label>
<input type="radio" name="rating" id="r-5">
<label for="r-5"></label>
</div>
<small>/roman.codes</small>
html, body {
font-family: 'Teko';
height: 100%;
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background: linear-gradient(90deg, #ffd00b 0%, #ffefad 100%);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
color: #FFF;
font-weight: 400;
font-size: 3em;
text-align: center;
text-shadow: 2px 2px 2px rgb(0, 0, 0, 0.6);
}
h1 {
margin-bottom: 0;
line-height: 1;
}
small {
margin-top: 10px;
color: #fffae7;
text-shadow: none;
}
.rating {
display: flex;
flex-direction: row-reverse;
width: 450px;
min-height: 70px;
}
.rating label {
display: flex;
flex: 1;
position: relative;
cursor: pointer;
}
.rating label:after {
font-family: 'FontAwesome';
transition: all 0.4s ease-out;
-webkit-font-smoothing: antialiased;
position: absolute;
content: "\f006";
color: #777;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
font-size: 70px;
line-height: 1;
}
.rating label:hover:after {
color: #fff;
}
.rating input {
display: none;
}
.rating input:checked + label:after,
.rating input:checked ~ label:after {
content: "\f005";
color: #fff;
text-shadow: 0 0 20px #F9BF3B;
text-shadow: 2px 2px 2px rgb(0, 0, 0, 0.6);
}
This Pen doesn't use any external JavaScript resources.