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


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


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.


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.


                <div id="masthead">
  <img src="" height="80" id="nyt-logo">

<div id="reviews">
   <!-- reviews -->

<div id="best-seller-titles">
  <!-- best sellers -->



                @import url(,400italic,600)
@import url(

  box-sizing: border-box
  background-color: #fff
  font-family: 'Open Sans', sans-serif

  display: block
  margin: 0 auto
  width: 200px
  transform: translateY(-30px)
  margin: 30px 0px
  padding: 20px 50px
  -webkit-box-shadow: 2px 2px 2px 0px rgba(0,0,0,0.21)
  -moz-box-shadow: 2px 2px 2px 0px rgba(0,0,0,0.21)
  box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.21)
    content:  attr(nyt-rank)
    font-family: 'Rozha One', serif
    font-size: 3rem
    display: inline-block
    width: 50px
    height: 50px
    line-height: 50px
    padding: 20px 20px
    text-align: center
    transform: translate(-100px)
    border: 4px solid #282c37
    background-color: #fff
    border-radius: 50%
    color: #282c37
    -webkit-box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.21)
    -moz-box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.21)  
    box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.21)
  max-width: 475px
  margin: 120px auto
  & a
    margin: 40px 0px 0px 0px
    text-decoration: none
    color: #2b90d9
    line-height: .2
  & h1, h2, h3, h4
    color: #282c37
  & p 
    color: #333030
    line-height: 1.4
    color: #333030
      opacity: .5
    & p
      color: #282c37
  position: fixed
  top: 0
  left: 0
  background: #FFF
  z-index: 9999
  width: 100%
  padding: 10px
  -webkit-box-shadow: 0px 1px 5px 0px #777
  -moz-box-shadow: 0px 1px 5px 0px #777
  box-shadow: 0px 1px 5px 0px #777
  transition: 200ms
    transition: 100ms


                fetch('', {
    method: 'get',
  .then(response => { return response.json(); })
  .then(json => { updateBestSellers(json); })
  .catch(error => {
    console.log('NYT API Error: Defaulting to nytimes archival data.', error);

function updateBestSellers(nytimesBestSellers) {
  nytimesBestSellers.results.forEach(function(book) {
    var isbn = book.isbns[0].isbn10;
    var bookInfo = book.book_details[0];
    var lastWeekRank = book.rank_last_week || 'n/a';
    var weeksOnList = book.weeks_on_list || 'New this week!';
    var listing = 
        '<div id="' + book.rank + '" class="entry">' + 
          '<p>' + 
          '<img src="" class="book-cover" id="cover-' + book.rank + '">' + 
          '</p>' + 
          '<h2><a href="' + book.amazon_product_url + '" target="_blank">' + bookInfo.title + '</a></h2>' +
          '<h4>By ' + + '</h4>' +
          '<h4 class="publisher">' + bookInfo.publisher + '</h4>' +
          '<p>' + bookInfo.description + '</p>' + 
          '<div class="stats">' +
            '<hr>' + 
            '<p>Last Week: ' + lastWeekRank + '</p>' + 
            '<p>Weeks on list: ' + weeksOnList + '</p>' +
          '</div>' +

    $('#' + book.rank).attr('nyt-rank', book.rank);

    updateCover(book.rank, isbn);

function updateCover(id, isbn) {
  fetch('' + isbn + "&key=AIzaSyAyINR2SYnt4K-0x6zh6S3x6NVUY15pY7Q", {
    method: 'get'
  .then(response => { return response.json(); })
  .then(data => {
    var img = data.items[0].volumeInfo.imageLinks.thumbnail;
    img = img.replace(/^http:\/\//i, 'https://');
    $('#cover-' + id).attr('src', img);
  .catch(error => {
    // console.log('Googel API Error: Defaulting to archival images for book #' + id + ' ISBN: ' + isbn);
    // var index = id - 1;
    // var img = archivedImages[index];
    // $('#cover-' + id).attr('src', img);

$(window).scroll(function (event) {
    var scroll = $(window).scrollTop();
    if (scroll > 50) {
      $('#masthead').css({'height':'50', 'padding' : '8'})
    } else {
      $('#masthead').css({'height':'100', 'padding':'10'});