Skip to content

Instantly share code, notes, and snippets.

@awayken
Created April 17, 2012 04:04
Show Gist options
  • Save awayken/2403374 to your computer and use it in GitHub Desktop.
Save awayken/2403374 to your computer and use it in GitHub Desktop.
Flipboard - detail, with hover.
/**
* Flipboard - detail, with hover.
*/
@-webkit-keyframes grow {
from { top: 44px; bottom: 88px; }
to { top: 0; bottom: 0; }
}
body {
color: #fff;
background: #000;
font-family: arial;
font-size: 0.9em;
line-height: 1;
}
.flipboard {
position: relative;
width: 320px;
height: 480px;
float: left;
border: 1px solid black;
margin: 0 1em 1em 0;
color: #000;
background: #fff;
}
.bar {
color: #000;
background: #fff;
}
header, footer, section {
color: #fff;
background: #000;
position: absolute;
left: 0;
right: 0;
overflow: hidden;
z-index: 10;
}
header {
top: 0;
height: 44px;
line-height: 43px;
}
header h1 {
text-align: center;
margin: 0;
padding: 0;
font-weight: normal;
font-size: 1.4em;
}
header a {
position: absolute;
top: 0;
color: #000;
text-decoration: none;
line-height: 34px;
}
header a:first-child {
left: 12px;
font-size: 3em;
}
header a:last-child {
right: 12px;
font-size: 2.4em;
}
footer {
bottom: 0;
height: 64px;
padding: 12px;
}
footer h1 {
display: inline-block;
margin: 4px 0 0 8px;
padding: 0;
font-size: 1.0em;
vertical-align: top;
}
footer img {
display: inline-block;
vertical-align: top;
margin-top: 4px;
}
footer img.buddy {
margin-top: 0;
border: 2px solid #fff;
-webkit-box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.2);
}
.time {
display: inline-block;
margin-top: 4px;
color: gray;
font-size: 0.8em;
}
section {
top: 44px;
bottom: 88px;
z-index: 50;
}
section:hover {
-webkit-animation-name: grow;
-webkit-animation-duration: .35s;
-webkit-animation-timing-function: ease-in-out;
top: 0;
bottom: 0;
}
section img, img.tall {
width: 100%;
height: auto;
}
img.wide {
height: 100%;
width: auto;
}
section div {
position: absolute;
bottom: 0;
width: 100%;
padding: 1em 12px 8px 12px;
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.65)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
background: linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#a6000000',GradientType=0 );
}
<div class="flipboard detail">
<header class="bar">
<a href="#back">&larr;</a>
<h1>Twitter</h1>
<a href="#search">&uarr;</a>
</header>
<section class="content">
<div>Blooming bluebells</div>
<img class="tall" src="http://placekitten.com/640/960" alt="Blooming bluebells" />
<!--<img class="wide" src="http://placekitten.com/960/640" alt="Blooming bluebells" />-->
</section>
<footer class="bar">
<img class="buddy" src="http://placekitten.com/28/28" alt="Buddy icon for @sarahpitts" />
<h1>sarahpitts</h1>
<img class="service" src="http://placekitten.com/12/12" alt="Service icon - Twitter" />
<span class="time">8 hours</span>
</footer>
</div>
<div class="flipboard detail">
<img class="tall" src="http://media.milesrausch.com/blooming_bluebells-20120416-232542.png.jpg" alt="A screenshot of the original." />
</div>
<p>"For fun, let's see how hard it is to mockup one of these Flipboard views in CSS," I said three hours ago.</p>
<p>So, here it is - an HTML and CSS mockup of one of the screens in Flipboard. The one on the left is my HTML and CSS experiment. The one on the right is a screenshot of the original in Flipboard.</p>
<p>Hover over the kitty cat for "full screen", complete with a minor CSS animation.</p>
<p>Only tested on Mac OS X Lion, Chrome 18.</p>
{"view":"split","fontsize":"80","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment