Skip to content

Instantly share code, notes, and snippets.

@PrinceYoulou
Created May 8, 2019 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrinceYoulou/9f267e535ad5774499229fb8a5332f0d to your computer and use it in GitHub Desktop.
Save PrinceYoulou/9f267e535ad5774499229fb8a5332f0d to your computer and use it in GitHub Desktop.
Simple Pure CSS Star Rating Widget Bootstrap 4
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<h1 class="text-center" alt="Simple">Simple Pure CSS Star Rating Widget Bootstrap 4</h1>
<div class="container">
<div class="starrating risingstar d-flex justify-content-center flex-row-reverse">
<input type="radio" id="star5" name="rating" value="5" /><label for="star5" title="5 star">5</label>
<input type="radio" id="star4" name="rating" value="4" /><label for="star4" title="4 star">4</label>
<input type="radio" id="star3" name="rating" value="3" /><label for="star3" title="3 star">3</label>
<input type="radio" id="star2" name="rating" value="2" /><label for="star2" title="2 star">2</label>
<input type="radio" id="star1" name="rating" value="1" /><label for="star1" title="1 star">1</label>
</div>
</div>
<h2 class="text-center" alt="Simple"><a href="http://themastercut.co">Check also WordPress Plugins on TheMasterCut.co</h2>
/***
* Simple Pure CSS Star Rating Widget Bootstrap 4
*
* www.TheMastercut.co
*
***/
@import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
/* Styling h1 and links
––––––––––––––––––––––––––––––––– */
h1[alt="Simple"] {color: white;}
a[href], a[href]:hover {color: grey; font-size: 0.5em; text-decoration: none}
body
{
background: #4a4a4c !important;
}
.starrating > input {display: none;} /* Remove radio buttons */
.starrating > label:before {
content: "\f005"; /* Star */
margin: 2px;
font-size: 8em;
font-family: FontAwesome;
display: inline-block;
}
.starrating > label
{
color: #222222; /* Start color when not clicked */
}
.starrating > input:checked ~ label
{ color: #ffca08 ; } /* Set yellow color when star checked */
.starrating > input:hover ~ label
{ color: #ffca08 ; } /* Set yellow color when star hover */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment