Skip to content

Instantly share code, notes, and snippets.

@dcneiner
Forked from jonathansampson/dabblet.css
Created June 8, 2012 15:03
Show Gist options
  • Save dcneiner/2896055 to your computer and use it in GitHub Desktop.
Save dcneiner/2896055 to your computer and use it in GitHub Desktop.
CSS Dice: An Experiment by Jonathan Sampson - @jonathansampson
/* CSS Dice: An Experiment by Jonathan Sampson - @jonathansampson */
.die.one:after {
box-shadow: 0 .2em 0 #FFF
}
.die.two:after {
background: transparent;
box-shadow: -2.3em -2.3em 0 #345,
2.3em 2.3em 0 #345,
-2.3em -2.3em 0 #FFF,
2.3em 2.4em 0 #FFF
}
.die.three:after {
box-shadow: -2.3em -2.3em 0 #345,
2.3em 2.3em 0 #345,
-2.3em -2.3em 0 #FFF,
2.3em 2.4em 0 #FFF,
0 .2em 0 #FFF
}
.die.four:after {
background: transparent;
box-shadow: -2.3em -2.3em 0 #345,
2.3em 2.3em 0 #345,
-2.3em 2.3em 0 #345,
2.3em -2.3em 0 #345,
-2.3em -2.3em 0 #FFF,
2.3em 2.4em 0 #FFF,
-2.3em 2.4em 0 #FFF,
2.3em -2.3em 0 #FFF
}
.die.five:after {
box-shadow: -2.3em -2.3em 0 #345,
2.3em 2.3em 0 #345,
-2.3em 2.3em 0 #345,
2.3em -2.3em 0 #345,
-2.3em -2.2em 0 #FFF,
2.3em -2.2em 0 #FFF,
2.3em 2.4em 0 #FFF,
-2.3em 2.4em 0 #FFF,
0 .2em 0 #FFF
}
.die.six:after {
background: transparent;
box-shadow: -2.3em -2.3em 0 #345,
-2.3em 0 0 #345,
-2.3em 2.3em 0 #345,
2.3em -2.3em 0 #345,
2.3em 0 0 #345,
2.3em 2.3em 0 #345,
-2.3em -2.1em 0 #FFF,
-2.3em .2em 0 #FFF,
-2.3em 2.4em 0 #FFF,
2.3em 2.4em 0 #FFF,
2.3em .2em 0 #FFF,
2.3em -2.1em 0 #FFF
}
.die {
border-top: 1px solid #f1f1f1;
width: 50px; height: 50px;
border-radius: 10px;
position: relative;
margin: 10px;
font-size: 6px;
display: inline-block;
box-shadow: 0px 5px 0 #CCC, 0 6px 3px #444, 0 10px 5px #999;
background-image: linear-gradient(top, #fefefe, #f1f1f1 80%)
}
.die:after {
content: "";
width: 20%;
height: 20%;
left: 50%;
top: 50%;
margin: -10%;
background: #345;
border-radius: 50%;
display: block;
position: absolute;
}
body { text-align: center }
<div class="die one"></div>
<div class="die two"></div>
<div class="die three"></div>
<div class="die four"></div>
<div class="die five"></div>
<div class="die six"></div>
<p>Pure CSS Dice. An experiment by <a href="http://twitter.com/jonathansampson">@jonathansampson</a></p>
{"view":"split-vertical","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