Pen Settings

HTML

CSS

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

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

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.

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

              
                // 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;
              
            
!

CSS

              
                @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%);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console