Skip to content

Instantly share code, notes, and snippets.

@ProLoser
Created March 15, 2012 00:19
Show Gist options
  • Save ProLoser/2040648 to your computer and use it in GitHub Desktop.
Save ProLoser/2040648 to your computer and use it in GitHub Desktop.
Facebook Timeline in CSS
/**
* Facebook Timeline in CSS
*/
* {
box-sizing: border-box;
}
body {
background: #f06;
background: linear-gradient(45deg, #fff, #fff);
min-height:100%;
}
/* For modern browsers */
.cf:before,
.cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
/* For IE 6/7 (trigger hasLayout) */
.cf {
zoom:1;
}
h1 {
margin: 5px 0;
}
ul {
list-style: none;
margin: 0;
padding: 0 0 5%;
border-right: 2px solid rgba(0,0,0,.3);
width: 50%;
}
li {
border: 1px solid red;
border-radius: 10px;
padding: 10px;
width: 90%;
margin: 5% 5% 0;
}
li:nth-child(even) {
float: right;
margin-right: -95%;
border-color: blue;
background: rgba(0,0,255,.2);
clear: right;
}
li:nth-child(odd) {
float: left;
clear: left;
background: rgba(255,0,0,.2);
}
li:nth-child(2) {
margin-top: 100px;
}
<ul class="cf">
<li>
<h1>Hello</h1>
<p>I hope this works</p>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
<li>
<h1>Hello</h1>
<p>I hope this works</p>
</li>
</ul>
{"view":"separate","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment