Skip to content

Instantly share code, notes, and snippets.

@geoffreycrofte
Created September 27, 2012 12:00
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 geoffreycrofte/3793641 to your computer and use it in GitHub Desktop.
Save geoffreycrofte/3793641 to your computer and use it in GitHub Desktop.
Rating with float right or direction rtl properties
/**
* Rating with float right or direction rtl properties
*/
h1 {
text-align: center;
font-family: Helvetica, Arial;
font-weight: normal;
color: #777;
font-size: 1.3em;
clear: both;
}
div + h1 {
padding-top: 4em;
}
.rating {
width: 245px;
margin: 0 auto 1em;
font-size: 3em;
}
.rating a {
float:right;
color: #aaa;
text-decoration: none;
transition: color .4s;
}
.rating a:hover,
.rating a:hover ~ a {
color: orange;
cursor: pointer;
}
.rating2 {
direction: rtl;
}
.rating2 a {
float:none
}
<h1>Rating with float:right; and general siblings selector</h1>
<div class="rating">
<a href="#5" title="Give 5 stars">☆</a><a href="#4" title="Give 4 stars">☆</a><a href="#3" title="Give 3 stars">☆</a><a href="#2" title="Give 2 stars">☆</a><a href="#1" title="Give 1 star">☆</a>
</div>
<h1>Rating with direction:rtl and general siblings selector</h1>
<div class="rating rating2">
<a href="#5" title="Give 5 stars">★</a><a href="#4" title="Give 4 stars">★</a><a href="#3" title="Give 3 stars">★</a><a href="#2" title="Give 2 stars">★</a><a href="#1" title="Give 1 star">★</a>
</div>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment