Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="intro">
  <div class="conainer">
    <h1>Vertical Timeline <span class="arrow">&#8595;</span></h1>
  </div>
</div>
<div class="timeline">
  <ul>
    <li>
      <div>
        <time>1934</time>
        At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium.
      </div>
    </li>
    <li>
      <div>
        <time>1937</time>
        Proin quam velit, efficitur vel neque vitae, rhoncus commodo mi. Suspendisse finibus mauris et bibendum molestie. Aenean ex augue, varius et pulvinar in, pretium non nisi.
      </div>
    </li>
    <li>
      <div>
        <time>1940</time>
        Proin iaculis, nibh eget efficitur varius, libero tellus porta dolor, at pulvinar tortor ex eget ligula. Integer eu dapibus arcu, sit amet sollicitudin eros.
      </div>
    </li>
    <li>
      <div>
        <time>1943</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
    <li>
      <div>
        <time>1946</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
    <li>
      <div>
        <time>1956</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
    <li>
      <div>
        <time>1967</time>
        Aenean condimentum odio a bibendum rhoncus. Ut mauris felis, volutpat eget porta faucibus, euismod quis ante.
      </div>
    </li>
    <li>
      <div>
        <time>1977</time>
        Vestibulum porttitor lorem sed pharetra dignissim. Nulla maximus, dui a tristique iaculis, quam dolor convallis enim, non dignissim ligula ipsum a turpis.
      </div>
    </li>
    <li>
      <div>
        <time>1985</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
    <li>
      <div>
        <time>2000</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
    <li>
      <div>
        <time>2005</time>
        In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
      </div>
    </li>
  </ul>
</div>
              
            
!

CSS

              
                *,
*::after,
*::before{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  padding-bottom: 50px;
  font: 16px/1.5 Lato, Arial, sans-serif;
  background-image: linear-gradient(to bottom, #7ccfb2, #633d85);
  color: rgba(0, 0, 0, .5);
}

/*Intro Section*/
.intro {
  padding: 250px 0;
}

.original {
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
}

button {
  padding: 10px;
}

a {
  color: #000;
  text-decoration: none;
}

.conainer{
  max-width: 1200px;
  width: 90%;
  margin: 0 auto;
  text-align: center;
}

h1 {
  font-size: 3.5rem;
  color: rgba(255, 255, 255, .9);
}

.arrow {
  display: inline-block;
  animation: arrow .7s ease-in alternate infinite;
}

/*Timeline SECTION*/
.timeline ul {
  padding: 50px 0;
  overflow-x: hidden;
}

.timeline li {
  position: relative;
  width: 6px;
  padding-top: 50px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .9);
  list-style-type: none;
}

.timeline li::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 50%;
}

.timeline div {
  position: relative;
  width: 400px;
  padding: 20px;
  background-image: linear-gradient(to bottom, #fe6976, #f36777);
}

.timeline li:nth-child(odd) div {
  left: 45px;
}
.timeline li:nth-child(even) div {
  left: -439px;
}

.timeline time {
  display: block;
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  color: rgba(0, 0, 0, .7);
}


.timeline div::after {
  content: "";
  position: absolute;
  border-style: solid;
  bottom: 7px;
}

.timeline li:nth-child(odd) div::after {
  left: -15px;
  border-width: 8px 16px 8px 0;
  border-color: transparent #f36776 transparent transparent;
}

.timeline li:nth-child(even) div::after {
  right: -15px;
  border-width: 8px 0 8px 16px;
  border-color: transparent transparent transparent #f36776;
}

/*ANIMATION EFFECTS*/
@keyframes arrow {
  100% {
    transform: translateY(10px);
  }
}

.timeline li::before {
  transition: background ease-in .9s;
}

.timeline div {
  transition: all ease-in-out .9s;
  visibility: hidden;
  opacity: 0;
}

.timeline li:nth-child(odd) div {
  transform: translateX(200px);
}

.timeline li:nth-child(even) div {
  transform: translateX(-200px);
}

.timeline li.in-view::before {
  background: #fe6976; 
}

.timeline li.in-view div {
  transform: none;
  visibility: visible;
  opacity: 1;
}

/*GOING RESPONSIVE*/
@media screen and (max-width: 900px) {
  .timeline div {
    width: 250px;
  }
  .timeline li:nth-child(even) div {
    left: -289px;
  }
}

@media screen and (max-width: 600px) {
  .intro {
    padding: 200px 0;
  }
  
  .timeline ul li {
    margin: 0 20px;
  }
  
  .timeline li div {
    width: calc(100vw - 70px);
  }
  .timeline li:nth-child(even) div {
    left: 45px;
  }
  .timeline li:nth-child(even) div::after {
    right: calc(100vw - 71px);
    border-width: 8px 16px 8px 0;
    border-color: transparent #f45b69 transparent transparent;
  }
}








              
            
!

JS

              
                (function() {
  "use strict";
  
  let items = document.querySelectorAll(".timeline li");
  
  function isElementInViewport(item) {
    let rect = item.getBoundingClientRect();
    return (
      rect.left > 0 &&
      rect.top > 0 &&
      rect.right < document.documentElement.clientWidth &&
      rect.bottom < document.documentElement.clientHeight
    );
  }
  
  function callbackFunc() {
    for (let i = 0; i < items.length; i++) {
      if (isElementInViewport(items[i])) {
        items[i].className = "in-view";
      }
    }
  }
  
  window.addEventListener("scroll", callbackFunc);
  window.addEventListener("load", callbackFunc);
  window.addEventListener("resize", callbackFunc);
})();
              
            
!
999px

Console