Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              // date, description, image, category
// empty categories start a new year/month
// you can have descriptions/images in new years, but not categories
- events = [['September'],
            ['September 27, 2013','I created a timeline.','','personal'],
            ['September 22, 2013','I ate a bagel.<br/>A delicious bagel','','personal'],
            ['September 22, 2013','Watched the Jetsons.','https://s.cdpn.io/40435/Jetsons_title.jpg','personal'],
            ['September 21, 2013','Coded a couple of things, but they were all glitchy.','','coding'],
            ['September 19, 2013','You can use <em>html</em> too!','','personal'],
            ['September 16, 2013','This is a longer entry, which is intended largely as a way of breaking the codepen does not let me use this word, but if the word I cannot use does not break then this thing is just stoooooopid. This is a responsive timeline, and it has the word responsive in it, so it must be cool! Yay for buzzwords!','','swag'],
            ['August'],
            ['August 23, 2013','Went on a romantic date to McDonald\'s.','','personal'],
            ['August 21, 2013','Made out with a pineapple.','https://s.cdpn.io/40435/pineapple.jpg','personal'],
            ['1995'],
            ['March 1, 1995','I\'m born.','','personal']]

.timeline#top
  %h1.timeline-heading Responsive Timeline
  %h2.timeline-subheading HAML + SASS
  %ul.timeline-events
  - events.each do |i,j,k,l|
    %li.timeline-event{ :data => { :category => "#{l}"} }
      .timeline-event-date #{i}
      %img.timeline-event-img{ :src => "#{k}" }
      .timeline-event-description #{j}
  %div.timeline-top-link 
    %a{ :href => "#top" } &#8593;
            
          
!
            
              @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Raleway:400,100,900);

$debugmode: false;

$color1: lighten(skyblue, 0%);
$color2: lighten(desaturate(#ff4200, 30%), 10%);
$f1: "Raleway", Arial, sans-serif;
$t: transparent;

@mixin font($weight) {
  font-family: $f1;
  font-weight: $weight;
}
::-webkit-scrollbar {
  background: #ddd;
  width: 6px;
}
::-webkit-scrollbar-thumb {
  background: darkgray;
}

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  word-wrap: break-word;
  @if $debugmode == true {
    outline: 1px dotted red;
  }
}

body {
  background: repeating-linear-gradient(135deg, $t 0, $t 4px, $color1 4px, $color1 8px), linear-gradient(#333, #222);
  background-attachment: fixed, scroll;
  background-size: 1rem 100%, 100%;
  background-position: 50% 0;
  background-repeat: no-repeat;
  font-family: sans-serif;
  
}

.timeline {
  margin: 0 auto;
  max-width: 60rem;
}

.timeline-heading {
  background: #ddd;
  font-size: 4rem;
  padding: 1rem;
  text-align: center;
  margin: 0;
  @if $debugmode == true {
    position: fixed;
    top: 0;
    width: 60rem;
    z-index: 100;
  }
  @include font(100);
  @media (max-width: 20rem) {
    & {
      font-size: 2rem
    }
  }
}

.timeline-subheading {
  @extend .timeline-heading;
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
  @if $debugmode == true {
    top: 6rem;
  }
}

@if $debugmode == true {
  .timeline-events {
    margin-top: 10rem;
  }
}

.timeline-event {
  list-style-type: none;
  width: 50%;
}


.timeline-event-description {
  
}

.timeline-event {
  display: inline-block;
  margin: -4px;
  padding: 2rem;
  width: 50%;
  vertical-align: middle;
  @media (max-width: 30rem) {
    & {
      width: 100%;
    }
  }
  &:nth-of-type(even):not([data-category=""]) {
    
  }
}

.timeline-event-date {
  background: $color1;
  padding: .5rem;
  position: relative;
  &::before {
    content: "";
    border-color: $t $t $t $color1;
    border-style: solid;
    border-width: 1.1rem;
    display: none;
    position: absolute;
    right: -2rem;
    top: 0;
  }
}

.timeline-event-img {
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  margin: -4px;
  position: relative;
  width: calc(100% + 8px);
  &[src=""] {
    display: none;
  }
}

.timeline-event-description {
  background: white;
  padding: 1rem;
  &:empty {
    display: none;
  }
}

.timeline-event[data-category=""] {
    display: block;
    width: 100%;
    overflow: hidden;
  .timeline-event-date {
    display: block;
    font-size: 3rem;
    padding: 1rem;
    text-align: center;
    @include font(900);
    &::before {
      display: none;
    }
    @media (max-width: 20rem) {
      & {
        font-size: 1.5rem;
      }
    }
  }
}

.timeline-top-link {
  background: #eee;
  border-radius: 50%;
  font-size: 3rem;
  display: block;
  margin: 1rem auto;
  height: 4rem;
  max-width: 4rem;
  text-align: center;
  a {
    text-decoration: none;
    color: darken($color1, 20%);
  }
  &:hover {
    background: lighten($color1, 20%);
  }
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console