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

              
                <div class="container overflow-hidden">
  <div class="btn-container">
    <button type=button data-down>scroll down</button>
    <button type=button data-up>scroll up</button>
  </div>
  <p>
    Doggo ipsum very hand that feed shibe very good spot noodle horse heckin good boys and girls, big ol. Heckin pats h*ck blop many pats pupperino, what a nice floof wrinkler I am bekom fat. Heckin good boys and girls doing me a frighten very jealous pupper what a nice floof, snoot fluffer heckin angery woofer, heckin good boys and girls fluffer. Maximum borkdrive doing me a frighten noodle horse heckin angery woofer waggy wags, yapper you are doing me a frighten boof. very hand that feed shibe such treat big ol pupper</p>
</div>

<div class="container overflow-clip">
  <button type=button>scroll down</button>
  <p>Doggo ipsum very hand that feed shibe very good spot noodle horse heckin good boys and girls, big ol. Heckin pats h*ck blop many pats pupperino, what a nice floof wrinkler I am bekom fat. Heckin good boys and girls doing me a frighten very jealous pupper what a nice floof, snoot fluffer heckin angery woofer, heckin good boys and girls fluffer. Maximum borkdrive doing me a frighten noodle horse heckin angery woofer waggy wags, yapper you are doing me a frighten boof. very hand that feed shibe such treat big ol pupper<p>
</div>
              
            
!

CSS

              
                * {
  &,
  &::before,
  &::after {
    box-sizing: border-box;
  }
}

body {
  display: flex;
}

.container {
  position: relative;
  width: 20em;
  margin: 1em;
  border: 1px solid #ddd;
  padding: 0.5em;

  p {
    height: 3em;
  }

  .btn-container {
    position: sticky;
    display: flex;
    gap: 1em;
    width: 100%;
    top: 0;
    left: 0;
  }

  button {
    flex: 1;
  }
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-clip {
  display: none;
  overflow: clip;
  -moz-hidden-unscrollable: clip;
}

              
            
!

JS

              
                document.body.addEventListener("click", ({ target }) => {
  if (target.tagName === "BUTTON") {
    const { parentNode } = target;

    if (typeof target.dataset.down === "string")
      parentNode.parentNode.scroll(0, parentNode.parentNode.scrollTop + 10);
    if (typeof target.dataset.up === "string")
      parentNode.parentNode.scroll(0, parentNode.parentNode.scrollTop - 10);
  }
});

              
            
!
999px

Console