Skip to content

Instantly share code, notes, and snippets.

@phil2phil
Created November 28, 2017 16:58
Show Gist options
  • Save phil2phil/fa47faa84c63a13cabf0ea3650c19830 to your computer and use it in GitHub Desktop.
Save phil2phil/fa47faa84c63a13cabf0ea3650c19830 to your computer and use it in GitHub Desktop.
Vertical timeline
<!DOCTYPE html>
<html>
<head>
<style>
.wrapper {
max-width: 200px;
border-right: 1px solid green;
padding-right: 10px;
}
.wrapper .element {
position: relative;
width: 80%;
margin-top: -30px;
padding: 20px;
border: 1px solid blue;
}
.wrapper .element:before {
position: absolute;
content: '';
width: 20px;
top: 10px;
right: -15px;
border-top: 1px solid red;
}
.wrapper .element:first-child {
margin-top: 0;
}
.wrapper .element:nth-child(2n) {
margin-left: 110%;
}
.wrapper .element:nth-child(2n):before {
right: auto;
left: -15px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="element">text text<p>text</p>texttext</div>
<div class="element">text text<p>text</p>texttext</div>
<div class="element">text text<p>text</p>texttext</div>
<div class="element">text text<p>text</p>texttext</div>
<div class="element">text text<p>text</p>texttext</div>
<div class="element">text text<p>text</p>texttext</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment