css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

              <div class='cell'>
  <h1>IMDB Top <span>250</span> 30</h1> 
  <div class='js-app'></div>

<script class='js-app-entry' id='entry' type='text/x-handlebars-template'>
  <div class='movie'>
    <h2 class='movie-title'>
      <b class='movie-title-number'>#{{index}}</b>
    {{#if rating}}
      <p class='movie-meta'>
        {{#times rating}} 
          <img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/5734/star.svg' alt='{{rating}} stars' width='24' height='24' />
      <p class='movie-meta'>Haven't seen it! 😱</p>
  background-color: #263238
  color: #37474f
  font-family: 'Montserrat'
h2, p
  margin: 0 0 10px

  color: #eceff1
  font-family: 'Oswald'
  font-size: 50px
  margin: 20px 0
  text-align: center
  text-transform: uppercase
    color: rgba(#eceff1, 0.5)
    text-decoration: line-through
  margin: 10px auto
  max-width: 730px
  background-color: #eceff1
  border-radius: 2px
  box-shadow: 0 3px 6px rgba(#263238, 0.9)
  margin-bottom: 10px
  padding: 40px
  position: relative
  font-weight: normal
  margin-bottom: 0
  color: #607d8b
  font-size: 50px
  opacity: 0.2
  position: absolute
  right: 20px
  top: 10px
              // Credit: http://stackoverflow.com/a/11924998
Handlebars.registerHelper( 'times', function( n, block ) {
  var accum = '';
  for( var i = 0; i < n; ++i )
      accum += block.fn(i);
  return accum;

class Spreadsheet {
  constructor( id, fields ) {
    const baseUrl = 'https://spreadsheets.google.com/feeds/list';
    this.url      = `${ baseUrl }/${ id }/od6/public/values?alt=json`;
    this.entry    = null;
    this.fields   = fields;
  loadData() {
    $.getJSON( this.url, ( results ) => {
      results.feed.entry.forEach( ( entry, index ) => {
        this.entry = entry;
        this.render( index + 1 );
  getEntry( entry, field ) {
    return entry[ `gsx$${ field }` ].$t;
  render( index ) {
    let data = {};
    data.index = index;
    this.fields.forEach( ( field, index ) => {
      data[ field ] = this.getEntry( this.entry, field );
    let source   = $( '.js-app-entry' ).html();
    let template = Handlebars.compile( source );
    let result   = template( data );

    $( '.js-app' ).append( result );

new Spreadsheet(
  '1LHAxuBp1yiekpPqdakvo2hjzBIIFq0Ml9yNqf4xlvEE', // The spreadsheet ID hash
  [ 'title', 'rating' ]                           // The spreadsheet fields
🕑 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.
Loading ..................