Simple 5-star Rating System with CSS and Html Radios

Author: jexordexan
Views Total: 214,135 views
Official Page: Go to website
Last Update: December 4, 2014
License: MIT


Simple 5-star Rating System with CSS and Html Radios


A pure CSS solution to create a simple five star rating widget using Html radio inputs and CSS3 transitions/transforms.

How to use it:

Include the required Font Awesome for star icons.

<link rel="stylesheet" href="//">

Create the Html for a five star rating widget using Html radio buttons.

<div class="stars">
  <form action="">
    <input class="star star-5" id="star-5" type="radio" name="star"/>
    <label class="star star-5" for="star-5"></label>
    <input class="star star-4" id="star-4" type="radio" name="star"/>
    <label class="star star-4" for="star-4"></label>
    <input class="star star-3" id="star-3" type="radio" name="star"/>
    <label class="star star-3" for="star-3"></label>
    <input class="star star-2" id="star-2" type="radio" name="star"/>
    <label class="star star-2" for="star-2"></label>
    <input class="star star-1" id="star-1" type="radio" name="star"/>
    <label class="star star-1" for="star-1"></label>

The required CSS/CSS3 styles for the rating widget.

div.stars {
  width: 270px;
  display: inline-block;
} { display: none; } {
  float: right;
  padding: 10px;
  font-size: 36px;
  color: #444;
  transition: all .2s;
} ~ {
  content: '\f005';
  color: #FD4;
  transition: all .25s;
} ~ {
  color: #FE7;
  text-shadow: 0 0 20px #952;
} ~ { color: #F62; } { transform: rotate(-15deg) scale(1.3); } {
  content: '\f006';
  font-family: FontAwesome;

See also  Customizable File Folder Icons with Pure CSS - FFolders.css

Leave a Reply

Your email address will not be published. Required fields are marked *