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.


    <h1>Intro: Salads That Sizzle</h1>
    <p>I have two young, very active boys, so summer means spending our days outside in the yard and cooking our meals on the grill as often as possible. We grill everything—including salads, which are a delicious surprise. A quick turn on the grill gives salad greens caramelized edges, while their interior leaves remain crisp-tender. Their flavor gets concentrated and infused with smokiness, making for salads that are complex and satisfying. For summer dinner parties they’re ideal—unexpected, visually appealing, and tasty—but they’re also easy enough for weeknights.</p>
    <h1>Step One: Start With Hearty Greens</h1>
    <p>Making a great grilled salad begins with choosing the right greens. Delicate ones like arugula, watercress, or mizuna don’t work. Instead, you need greens with thick leaves that won’t wilt too quickly, turn slimy, or burn to a crisp. You should also use greens with a sturdy core, so you can cut a head into halves or wedges and have the leaves stay together on the grill.</p>
    <h1>Step Two: Bring on the Romaine</h1>
    <p>Substantial and slightly bitter greens in the romaine and chicory families are perfect for the grill. I like to pair them with bright, tangy dressings, like a lemony Caesar or a summery fines herbes salsa verde. Another of my favorites to grill is iceberg lettuce because it forms such sturdy, attractive wedges. As a milder lettuce, it benefits from stronger flavors like bacon and blue cheese, which make for a great update on the classic steakhouse iceberg wedge salad. These three salads work because they’re simple, with just enough bold flavors to highlight the delicious smokiness of the grilled greens.</p>
    <h1>Step Three: Grill Fast and Hot</h1>
    <p>Once you’ve settled on what to grill, the how to grill part is pretty straightforward. Place the greens over medium-hot direct heat and leave them alone just long enough for them to develop grill marks. Be sure your fire is the right temperature: too hot and the greens will burn; not hot enough and they will wilt and become slimy.</p>
    <h1>Conclusion: More Tips</h1>
    <p>There are a few more things to keep in mind when grilling greens. They absorb other flavors very easily, so always clean the grill grate well or your salad may end up tasting like what you grilled the day before. If you’re using charcoal, avoid lighter fluid and lighter-fluid-infused charcoal briquettes, which can impart a chemical taste. It’s also important to have your dressing and toppings prepared before you put the greens on the grill—these salads are best served immediately, and they can be ready faster than it takes the family to come in from the yard.</p>
  <div class="vcent"></div>
  <div class="container">
    <p>Brought to you by <a href="" target="_blank">rileyjshaw</a> with heavy inspiration from <a href="" target="_blank">slinky.js</a>. Recipe from <a href="" target="_blank"></a>.</p>



                $sectionWidth: 480px

html, body, .vcent
  height: 100%
  margin: 0
  font-family: 'PT Serif', serif
  color: #333
  -webkit-font-smoothing: antialiased
  -moz-osx-font-smoothing: grayscale

  position: relative
  width: $sectionWidth
  margin: 0 auto
  overflow: hidden
    position: relative
    height: 42px
    width: $sectionWidth
    box-sizing: border-box
    margin: 0
    padding-left: 1em
    font: 16px/42px 'PT Sans', sans-serif
    background: skyblue
    cursor: pointer

      position: absolute
      top: 0
      bottom: 0
      left: 0
      background: rgba(255, 255, 255, .2)

      position: relative

    margin-left: 18px
    margin-right: 18px
    line-height: 1.46em
    font-size: 16px
    text-align: justify

  position: relative
  height: 100%
  width: 100%
  text-align: center
  font-size: 36px
  color: #eee
  background: #333
    color: #eee
.vcent, .container
  vertical-align: middle
  display: inline-block
  width: 60%
  text-align: justified


                !function () {
  function getTop (element) {
    var top = 0;
    do {
      top += element.offsetTop  || 0;
      element = element.offsetParent;
    } while(element);

    return top;

  function smoothScroll (top) {
    var windowTop = window.pageYOffset;
    if (top !== windowTop) {
      var direction = top - windowTop > 0 ? 1 : -1;
      function scroll () {
        var diff = (top - windowTop) * direction;
        if (diff > 0) {
          windowTop += Math.min(diff, 30) * direction;
          window.scrollTo(0, windowTop);
  function initSections (section, i) {
    if (section.el) { = getTop(section.el);
      section.height = section.el.offsetHeight;
      section.header.onclick = function () { smoothScroll( - topLatch); };
      section.fixed = false; = = '';
      return section;

    var h1 = section.querySelector('h1');
    var progress;
    var height = section.offsetHeight;
    var topLatch = i * 42;
    var top = getTop(section);
    h1.innerHTML = '<span class="progress"></span><span class="text">' + h1.textContent + '</span>';
    progress = h1.querySelector('.progress');
    // todo: messy, but easy to override
    h1.onclick = function () { smoothScroll(top - topLatch); };
    return {
      el: section,
      header: h1,
      progress: progress,
      top: top,
      height: height,
      topLatch: topLatch,
      bottomLatch: (sections.length - 1 - i) * 42,
      fixed: false
  function scrollHandlerInner (section, top) {
    var diff = top -;
    var progressStyle =;
    var progressStyleWidth = progressStyle.width;
    if (diff >= -section.topLatch) {
      if (diff < section.height) {
        progressStyle.width = Math.min((diff + section.topLatch) / (section.height - 42), 1) * 100 + '%';
      } else if (progressStyleWidth !== '100%') progressStyle.width = '100%';
      if (section.fixed !== 'top') {
        section.fixed = 'top'; = 'position:fixed;top:' + section.topLatch + 'px'; = 'padding-top: 42px';
    } else {
      if (progressStyleWidth !== '0px') progressStyle.width = 0;
      if (diff + windowHeight - section.bottomLatch - 42 < 0) {
        if (section.fixed !== 'bottom') {
          section.fixed = 'bottom';
 = 'position: fixed;bottom:' + section.bottomLatch + 'px';
 = 'padding-bottom: 42px';
      } else if (section.fixed) {
        section.fixed = false; = = '';

  function stickToBottom (section) {
    section.fixed = false; = 'position: absolute;bottom:' + section.bottomLatch + 'px'; = '100%';

  function scrollHandler () {
    var top = window.pageYOffset;
    // todo handle scrolling past top
    if (articleBottom - top < compressedHeight) {
      if (!stickyLatch) {
        stickyLatch = 'bottom';
    } else {
      if (stickyLatch) stickyLatch = false;
      sections.forEach(function (section) {
        scrollHandlerInner(section, top);

  function initGlobal () {
    windowHeight = window.innerHeight;
    articleTop = getTop(article);
    sections =;
    stickyLatch = false;
    articleBottom = articleTop + article.offsetHeight;
  var article = document.querySelector('article');
  var sections ='section'), 0);
  var compressedHeight = sections.length * 42;
  var windowHeight, articleTop, articleBottom, sections, stickyLatch, resizeDone;


  window.addEventListener('scroll', scrollHandler, false);
  window.addEventListener('resize', function () {
    resizeDone = setTimeout(initGlobal, 500);
  }, false);