Skip to content

Instantly share code, notes, and snippets.

@deltafactory
Created September 2, 2014 21:44
Show Gist options
  • Save deltafactory/6e1cb71cfc8bb169181d to your computer and use it in GitHub Desktop.
Save deltafactory/6e1cb71cfc8bb169181d to your computer and use it in GitHub Desktop.
Create a flip clock effect in pure CSS. Inspired by http://battleforthenet.com/sept10th/. View demo at http://bl.ocks.org/deltafactory/6e1cb71cfc8bb169181d
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial;
}
.flippy {
position: relative;
display: inline-block;
background-color: #706F9C;
border-radius: 20px;
box-shadow: 0 5px 50x #000;
color: white;
height: 120px;
}
.flippy .day {
text-align: center;
font-size: 100px;
line-height: 120px;
padding: 10px 5px;
font-weight: bold;
}
.flippy sup {
font-weight: bold;
font-size: 12px;
}
.flippy .month {
position: absolute;
display: block;
text-align: center;
bottom: 10px;
left: 0;
width: 100%;
height: 10px;
text-transform: uppercase;
font-weight: bold;
font-size: 10px;
}
.flippy:before {
content: '';
position: absolute;
top: 0;
left: 0;
display: block;
height: 60px;
width: 100%;
background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0,0,0,0)), color-stop(0.4, rgba(0,0,0,0)), to(rgba(0,0,0,0.20)));
background: -webkit-linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.20) 100%);
background: -moz-linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.20) 100%);
background: -o-linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.20) 100%);
background: linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.20) 100%);
border-radius: 20px 20px 0 0;
border-bottom: solid 1px rgba( 0,0,0, 0.4 );
}
</style>
</head>
<body>
<div class="flippy">
<span class="day">10<sup>th</sup></span>
<span class="month">September</span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment