cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <article class="post">
  <h1>Responsive Footnotes</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expedita atque cum nihil nostrum voluptatibus dolor possimus totam delectus rerum harum. Nisi perspiciatis neque modi harum quidem laudantium earum possimus. Fugit dolorem quam doloremque tempore sequi nesciunt id sint culpa harum maxime quidem quibusdam et dolore eum maiores expedita sunt laboriosam quos illo ratione autem soluta veniam.<sup class="post-marker"><a href="#note:1">1</a></sup> Nostrum architecto omnis quod sunt ratione mollitia cupiditate ipsa tempore!</p>
  <p>Architecto blanditiis hic doloribus amet ullam molestiae necessitatibus iure dolor et adipisci possimus id omnis error optio est pariatur porro sapiente eligendi maiores eaque voluptas veritatis expedita sed aliquam consectetur? Expedita itaque quaerat veniam pariatur! Officia adipisci beatae unde quaerat quisquam eveniet est dolorem voluptatem numquam animi.</p>
  <p>Perspiciatis atque voluptas voluptatum eligendi minima officia tenetur. Qui asperiores animi pariatur sapiente error velit eius veritatis nisi blanditiis ratione iure vero hic nesciunt maiores sint ab provident iste neque aliquid impedit delectus eaque voluptatum sequi tempore reprehenderit nulla accusantium. Voluptas porro temporibus quisquam officiis neque tempore sunt maiores iste quos in. Ipsum eveniet doloremque voluptas perferendis veritatis! Ullam amet quam totam commodi consectetur et ducimus.<sup class="post-marker"><a href="#note:2">2</a></sup></p>
  <p>Quasi animi ex error recusandae dolor rerum saepe numquam veritatis ducimus pariatur aliquam praesentium quaerat alias sequi qui aperiam ad inventore quibusdam fuga voluptates consectetur minus labore?<sup class="post-marker"><a href="#note:3">3</a></sup> Totam eaque adipisci dolorum delectus magnam inventore praesentium hic perferendis odit amet maxime nesciunt nisi. Sit a asperiores error pariatur iste nam aut repellendus at ipsa nulla earum distinctio hic quisquam aperiam laudantium delectus placeat voluptatum inventore obcaecati possimus! Magni veniam praesentium natus laboriosam fuga itaque accusantium sequi labore expedita voluptate ullam fugiat nobis non iusto ex nihil.</p>
  <ol class="post-footnotes">
    <li id="note:1">Read the tutorial <a href="http://johndjameson.com/blog/responsive-sidenotes/">here</a>.</li>
    <li id="note:2">Saepe nisi dolor ex qui et iusto molestiae?</li>
    <li id="note:3">Voluptas ex quam blanditiis quia placeat in ut maiores illum fuga itaque quos fugiat eos mollitia cum neque ipsam.</li>
  </ol>
</article>
            
          
!
            
              body {
  line-height: 1.5;
  padding: 0 1.5rem;
}
    
a {
  color: blue;  
}
  
p {
  margin-bottom: 1.5rem;
  margin-top: 0;
}
  
.post {
  margin: 0 auto;
  max-width: 30em;
}
  
.post-marker::before {
  content: "\00a0"; /* A non-breaking space glues a marker to its target word. */
  font-size: 0.25em;
}
  
.post-marker a {
  font-weight: bold;
  letter-spacing: 1px;
  text-decoration: none;
}
    
.post-marker a::before {
  content: "[";  
}
  
.post-marker a::after {
  content: "]";  
}
    
.post-subject {
  position: relative;  
}
    
.post-sidenote {
  box-sizing: border-box;
  color: #999;
  display: none;
  font-style: italic;
  left: 100%;
  padding-left: 1.5rem;
  position: absolute;
  top: 0;
  width: 33.333333%;
}
  
.post-footnotes {
  border-top: 1px solid #999;
  color: #999;
  padding-top: 1.5rem;
}

@media screen and (min-width: 50em) {
  .post.has-sidenotes .post-marker {
    display: none;
  }
      
  .post.has-sidenotes .post-sidenote {
    display: block;
  }
  
  .post.has-sidenotes .post-footnotes {  
    display: none;
  }
}

            
          
!
            
              var $post = $('.post'),
    $markers = $('.post-marker'),
    $footnotes = $('.post-footnotes');

function createSidenotes() {
    var $footnoteArray = $footnotes.children();

    $markers.parent().wrap("<div class='post-subject'></div>");

    for (var i = 0, len = $markers.length; i < len; i++) {
        $($('.post-subject')[i]).append(
            // role='complementary' provided for ARIA support
            "<aside class='post-sidenote' role='complementary'><p>"
            + $($footnoteArray[i]).html()
            + "</p></aside>"
        );
    }
  
    $post.addClass('has-sidenotes');
}

createSidenotes();
            
          
!
999px
Loading ..................

Console