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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


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.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:


Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO


                <div id="header">
  Haha, I am a header. Nah.. Nah na na na
<div id="longDiv">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed nibh nibh, ut volutpat turpis. Aliquam at nunc nisl. Curabitur sit amet lectus eget ligula interdum molestie. Vestibulum ultricies tortor eleifend mi luctus lacinia. Aliquam augue felis,
  tempus ac mattis ac, volutpat id sapien. Sed at arcu orci, ac sodales mi. Sed erat sapien, feugiat auctor dapibus sed, rutrum quis urna. Donec pulvinar mollis ligula quis tempus. Sed consectetur purus id ipsum volutpat fringilla sagittis est sodales?
  Integer quis mollis eros! Morbi quis dignissim est. In quis sapien mi! In vestibulum, leo et pellentesque consectetur, turpis metus vehicula ipsum, vel facilisis est lectus non orci. Donec aliquet lacus vel tellus semper luctus. Lorem ipsum dolor sit
  amet, consectetur adipiscing elit. Cras erat eros, scelerisque ac rhoncus eu, dapibus non magna. Fusce ante erat, sollicitudin id fringilla ac, viverra id turpis. Suspendisse sed nisl justo, quis elementum dui. Class aptent taciti sociosqu ad litora
  torquent per conubia nostra, per inceptos himenaeos. Cras interdum, nisi non placerat elementum; nisl turpis feugiat lectus, eu blandit metus arcu vitae nunc. Proin egestas, tortor ullamcorper mattis luctus, sapien augue rhoncus erat; vel cursus quam
  purus lobortis velit. Etiam posuere hendrerit nunc id volutpat! Quisque tempus libero sed leo pulvinar sed adipiscing justo volutpat. Integer consequat semper semper. Cras tincidunt nunc id quam pulvinar id rhoncus neque dictum. Pellentesque turpis
  sem, semper eu accumsan eget, tempor tempus ligula. Quisque feugiat luctus enim, vitae dictum lectus fermentum ut.


                #header {
  top: 15px;
  left: 50px;
  position: absolute;
  width: 100px;
  height: 100px;

#header.pinned {
  position: fixed;

#longDiv {
  margin: 100px 0 0 0;
  width: 1000px;
  height: 2000px;
  border: 1px #000 solid;



                var banner = $('#header'),
spot = $(this).scrollTop();

$(window).scroll(function() {
  var place = $(this).scrollTop(),
  moved = $(this).scrollLeft(),
  vertical = spot != place,
  stuck = banner.hasClass('pinned');
  spot = place;

  if (vertical) {
    if (moved) banner.css('transform', 'translateX(' + moved + 'px)');
  else {
    banner.attr('style', '');
    if (moved && !stuck) banner.addClass('pinned');
Promise you'll await for me.