Created
December 10, 2012 11:09
-
-
Save matijs/4250019 to your computer and use it in GitHub Desktop.
star rating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Star rating</title> | |
<style> | |
html { background: slategrey; color: ivory; font-family: Helvetica, Arial, sans-serf; font-size: 16px; } | |
body { margin: 2em; } | |
.result { background: ivory; border-radius: 1em; border: 2px solid darkslategrey; color: darkslategrey; font-size: 1em; overflow: hidden; text-shadow: 0 1px 1px rgba(0,0,0,0.4); width: 6em; } | |
.result > em { font-style: normal; } | |
.result > span { position: absolute; left: -10000em; } | |
[data-rating]:before { content: attr(data-rating); margin: 0 .5em; } | |
</style> | |
</head> | |
<body> | |
<h1>Star rating</h1> | |
<p>Using good old fashioned elements we've loved for a long time</p> | |
<p class="result"><em data-rating="☆☆☆☆☆">0</em><span> stars of 5 stars</span></p> | |
<p class="result"><em data-rating="★☆☆☆☆">1</em><span> star of 5 stars</span></p> | |
<p class="result"><em data-rating="★★☆☆☆">2</em><span> stars of 5 stars</span></p> | |
<p class="result"><em data-rating="★★★☆☆">3</em><span> stars of 5 stars</span></p> | |
<p class="result"><em data-rating="★★★★☆">4</em><span> stars of 5 stars</span></p> | |
<p class="result"><em data-rating="★★★★★">5</em><span> stars of 5 stars</span></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment