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

              
                <section class="timeline-carousel">
   <div class="container">
      <div class="row">
         <div class="col-8 offset-2 text-center mb-5">
            <h1>Horizontal timeline</h1>
            <p class="lead text-muted">Below is a concept of a horizontal timeline slider. You can drag the slides or click on the previous and next buttons.</p> 
            <p><a class="text-white" target="_blank" href="https://codepen.io/davidbiek/pen/BaWYWME">Bootstrap 5 version</a></p>
         </div>
      </div>
   </div>
   <div class="timeline-carousel__item-wrapper" data-js="timeline-carousel">
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2001-2003</span>
            <span class="month">Eget felis eget nunc lobortis mattis</span>
            <p>Eget felis eget nunc lobortis mattis aliquam faucibus. Viverra nam libero justo laoreet sit amet. Elementum pulvinar etiam non quam lacus suspendisse faucibus. Nam libero justo laoreet sit amet cursus sit amet. Risus sed vulputate odio ut enim blandit. Quam adipiscing vitae proin sagittis nisl rhoncus.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2003</span>
            <span class="month">Tristique magna sit amet</span>
            <p>Tristique magna sit amet purus gravida quis blandit turpis.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2003</span>
            <span class="month">Mauris pellentesque pulvinar pellentesque habitant</span>
            <p>Mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus. Eu turpis egestas pretium aenean pharetra magna ac placerat vestibulum. Cursus in hac habitasse platea dictumst quisque. Ipsum dolor sit amet consectetur adipiscing elit. </p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2004</span>
            <span class="month">Cum sociis natoque penatibus</span>
            <p>Cum sociis natoque penatibus et magnis dis. Interdum velit laoreet id donec ultrices tincidunt arcu non. Lorem sed risus ultricies tristique. Dui vivamus arcu felis bibendum ut. Tortor id aliquet lectus proin nibh nisl condimentum id.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <div class="pointer"></div>
            <span class="month">Dictumst vestibulum rhoncus est</span>
            <p>Viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est. Posuere ac ut consequat semper.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2005</span>
            <span class="month">Id nibh tortor id aliquet</span>
            <p>Nunc eget lorem dolor sed viverra. Id nibh tortor id aliquet. Sed blandit libero volutpat sed cras. Fermentum posuere urna nec tincidunt praesent. Id ornare arcu odio ut sem nulla pharetra diam.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2006</span>
            <span class="month">Pulvinar neque laoreet suspendisse</span>
            <p>Pulvinar neque laoreet suspendisse interdum consectetur. Libero volutpat sed cras ornare. Ac auctor augue mauris augue.</p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->
      
      <!--Timeline item-->
      <div class="timeline-carousel__item">
         <div class="timeline-carousel__image">
            <div class="media-wrapper media-wrapper--overlay" style="background: url('https://via.placeholder.com/550x320/171717/cccccc?text=550x320') center center; background-size:cover;"></div>
         </div>
         <div class="timeline-carousel__item-inner">
            <span class="year">2007</span>
            <span class="month">Egestas quis ipsum</span>
            <p>Non odio euismod lacinia at. Egestas quis ipsum suspendisse ultrices gravida. Dui nunc mattis enim ut tellus elementum sagittis vitae. Lectus quam id leo in vitae turpis massa sed elementum. Ridiculus mus mauris vitae ultricies leo integer malesuada. Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus./p>
            <a href="#" class="read-more">Read more</a>
         </div>
      </div>
      <!--/Timeline item-->

   </div>
</section>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Libre+Franklin:300,400,600,700,800,900&display=swap');
@import url('https://fonts.googleapis.com/css?family=Roboto:300&display=swap');

//Colors
$white-20: rgba(255, 255, 255, 0.2);
$white-60: rgba(255, 255, 255, 0.6);
$white: rgba(255, 255, 255, 1);
$main-color: #ffc107;
$bg-color: #323232;

* {
   outline: none;
}

//Timeline
.timeline-carousel {
   margin: 0;
   background-color: $bg-color;
   font-family: "Roboto", sans-serif;
   font-weight: 400;
   padding: 86px 6.9444% 90px 6.9444%;
   position: relative;
   overflow: hidden;
   &:after,
   &:before {
      content: "";
      position: absolute;
      display: block;
      top: 0;
      height: 100%;
      width: 6.9444%;
      background-color: $bg-color;
      z-index: 3;
      width: 6.9444%;
   }
   &:after {
      left: 0;
   }
   &:before {
      right: 0;
      opacity: 0;
   }
   .slick-list {
      overflow: visible;
   }
   .slick-dots {
      bottom: -73px;
   }
   h1 {
      color: $white;
      font-family: 'Libre Franklin', sans-serif;
      font-weight: 700;
   }
   p {
      color: $white;
      font-weight: 300;
   }
   &__image {
      padding-right: 30px;
   }
   &__item {
      cursor: grab;
      cursor: -moz-grab;
      cursor: -webkit-grab;
      .media-wrapper {
         opacity: 0.4;
         padding-bottom: 71.4%;
         -webkit-transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
         -o-transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
         transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
      }
      &:last-child {
         .timeline-carousel__item-inner {
            &:after {
               width: calc(100% - 30px);
            }
         }
      }
   }
   &__item-inner {
      position: relative;
      padding-top: 45px;
      &:after {
         position: absolute;
         width: 100%;
         top: 45px;
         left: 0;
         content: "";
         border-bottom: 1px solid $white-20;
      }
      .year {
         font-family: 'Libre Franklin', sans-serif;
         font-size: 36px;
         line-height: 36px;
         color: $white;
         display: table;
         letter-spacing: -1px;
         padding-right: 10px;
         background-color: $bg-color;
         z-index: 1;
         position: relative;
         margin: -15px 0 20px;
         font-weight: 700;
         &:after {
            content: "";
            position: absolute;
            display: block;
            left: -10px;
            top: 0;
            height: 100%;
            width: 10px;
            background-color: $bg-color;
            z-index: 3;
         }
      }
      .month {
         font-family: 'Libre Franklin', sans-serif;
         font-size: 12px;
         text-transform: uppercase;
         color: $main-color;
         display: block;
         margin-bottom: 10px;
         font-weight: 600;
      }
      p {
         font-size: 12px;
         line-height: 18px;
         color: $white;
         width: 60%;
         font-weight: 400;
         margin-bottom: 15px;
      }

      .read-more {
         font-size: 12px;
         color: $main-color;
         display: table;
         margin-bottom: 10px;
         font-weight: 900;
         text-decoration: none;
         position: relative;
         &:after {
            content: "";
            position: absolute;
            left: 0;
            bottom: -1px;
            width: 0;
            border-bottom: 2px solid $main-color;
            -webkit-transition: all 0.2s cubic-bezier(0.55, 0.085, 0.68, 0.53);
            -o-transition: all 0.2s cubic-bezier(0.55, 0.085, 0.68, 0.53);
            transition: all 0.2s cubic-bezier(0.55, 0.085, 0.68, 0.53);
         }
         &:hover {
            &:after {
               width: 100%;
            }
         }
      }
      .pointer {
         height: 29px;
         position: relative;
         z-index: 1;
         margin: -4px 0 16px;
         &:after,
         &:before {
            position: absolute;
            content: "";
         }
         &:after {
            width: 9px;
            height: 9px;
            border-radius: 100%;
            top: 0;
            left: 0;
            background-color: $main-color;
         }
         &:before {
            width: 1px;
            height: 100%;
            top: 0;
            left: 4px;
            background-color: $main-color;
         }
      }
   }

   .slick-active {
      .media-wrapper {
         opacity: 1 !important;
      }
   }
}

// Slick dots
.slick-dots {
   bottom: 160px;
   list-style: none;
   position: absolute;
   width: 100%;
   left: 0;
   text-align: center;
   z-index: 2;
   li {
      cursor: grab;
    cursor: -moz-grab;
    cursor: -webkit-grab;
      display: inline-block;
      margin: 0 6px;
      position: relative;
      width: 10px;
      height: 10px;
      &:last-child {
         margin-right: 0;
      }
      &.slick-active {
         button {
            background: $main-color;
            border-color: $main-color;
         }
      }
      button {
         display: block;
         font-size: 0;
         width: 10px;
         height: 10px;
         padding: 0;
         background-color: $white-60;
         border-color: $white-60;
         cursor: pointer;
         -webkit-transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
         -o-transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);

         transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
         &:hover {
            background: $main-color;
            border-color: $main-color;
         }
      }
   }
}

// Link
.link{
   position:absolute;
   left:0;
   bottom:0;
   padding:20px;
   z-index:9999;
   a{
      display:flex;
      align-items:center;
      text-decoration:none;
      color:#fff;
   }
   .fa{
      font-size:28px;
      margin-right:8px;
      color:#fff;
   }
}

.slick-prev, .slick-next {

   svg {
      height: auto;
      width: 18px;
      padding-bottom: 2px;
   }

   .btn {     
      border-radius: 0;
      font-family: 'Libre Franklin', sans-serif;
      font-size: 12px;
      text-transform: uppercase;
      font-weight: 700;
   }

}

.slick-prev, .slick-next {
   position: absolute;
   top: 0;
   z-index: 9999;
   border-radius: 0;
   font-family: 'Libre Franklin', sans-serif;
   font-size: 12px;
   text-transform: uppercase;
   font-weight: 700;
}

.slick-prev {
   left: 0;
}
.slick-next {
   right: 30px;
}
              
            
!

JS

              
                $.js = function (el) {
    return $('[data-js=' + el + ']')
};

function carousel() {
  $.js('timeline-carousel').slick({
    infinite: false,
    arrows: true,
     arrows: true,
    prevArrow: '<div class="slick-prev"> <div class="btn mr-3 btn-warning d-flex justify-content-center align-items-center"> <div>Previous</div><svg class="ml-1" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve"> <path d="M10.1,19.1l1.5-1.5L7,13h14.1v-2H7l4.6-4.6l-1.5-1.5L3,12L10.1,19.1z"/> </svg></div></div>',
    nextArrow: '<div class="slick-next"> <div class="btn btn-warning d-flex justify-content-center align-items-center"> <svg class="mr-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M 14 4.9296875 L 12.5 6.4296875 L 17.070312 11 L 3 11 L 3 13 L 17.070312 13 L 12.5 17.570312 L 14 19.070312 L 21.070312 12 L 14 4.9296875 z"/> </svg> <div>Next</div></div></div>',
    dots: true,
    autoplay: false,
    speed: 1100,
    slidesToShow: 3,
    slidesToScroll: 3,
    responsive: [
      {
        breakpoint: 800,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      }]
  });
}

carousel();
              
            
!
999px

Console