Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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>
  Comparing different ways to make custom scrollbar. If the plugins broke the layout I didn't fix it - that's why they're not alligned properly.
</div>
<div>
  Which way is the most reliable,
  browser compatible way to make
  custom scrollbars?
  Which plugin is most actively maintained right now?
  Comments?
</div>
<div id=d1>
  <div id=d1i>
    Native
  </div>
</div>
<div id=d2>
  <div id=d2i>
    <a href="https://css-tricks.com/custom-scrollbars-in-webkit/" target="_blank">CSS <br>(webkit only)</a>
</div>
</div>
<div id=d3>
  <div id=d3i>
    <a href="http://jscrollpane.kelvinluck.com/" target="_blank">jScrollPane</a>
  </div>
</div>

<div id=d5>
  <div id=d5i>
    <a href="https://areaaperta.com/nicescroll/" target="_blank">Nicescroll</a>
  </div>
</div>
<div id=d6>
  <div id=d6i>
    <a href="https://manos.malihu.gr/jquery-custom-content-scroller/" target="_blank">mCustomScrollbar</a>
  </div>
</div>
<div id=d7>
  <div id=d7i>
    <a href="https://github.com/Charuru/lionbars/#readme" target="_blank">Lion Bars</a>
  </div>
</div>
  
<div id=d8>
  <div id=d8i>
    <a href="http://formstone.it/components/scroller" target="_blank">fs scroller</a>
  </div>
</div>

  <!-- ERRORS:
<div id=d9>
  <div id=d9i>
    <a href="http://baijs.com/tinyscrollbar/" target="_blank">Tiny Scrollbar</a>
  </div>
</div>
-->
  
<div id=d10>
  <div id=d10i>
    <a href="https://github.com/jnicol/trackpad-scroll-emulator" target="_blank">Trackpad Scroll Emulator</a>
  </div>
</div>

  
  
  

<!-- must be at the end because it breaks the layout of other divs -->
<div id=d4>
  <div id=d4i>
    <a href="https://noraesae.github.io/perfect-scrollbar/" target="_blank">perfect<br> scrollbar</a>
      (must be at the end because it breaks the layout of other divs)
  </div>
</div>
              
            
!

CSS

              
                body {
  background: linear-gradient(45deg, #1d1f20, #2f3031);
}
h2 {
  color: white;
}
#d1,#d2,#d3,#d4,#d5,
#d6,#d7,#d8,#d9,#d10 {
  margin:20px;
  margin-right:0;
  height:200px;
  width:100px;
  display:inline-block;
  overflow-x:hidden;
 
}
#d1i,#d2i,#d3i,#d4i,#d5i,
#d6i,#d7i,#d8i,#d9i,#d10i {
  margin:0px;
  padding:0px;
  height:600px;
  width:100px;
  display:block;
  overflow:hidden;
  font-size: small;
}
div,a {
  color: white;
  text-shadow:
   -1px -1px 0 #000,  
    1px -1px 0 #000,
   -1px  1px 0 #000,
    1px  1px 0 #000;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
#d1i {
  background: url(http://lorempixel.com/100/600/nature/1/);
}
#d1i {
  background: url(http://lorempixel.com/100/600/nature/1/);
}
#d2i {
  background: url(http://lorempixel.com/100/600/nature/2/);
}
#d3i {
  background: url(http://lorempixel.com/100/600/nature/3/);
}
#d4i {
  background: url(http://lorempixel.com/100/600/nature/4/);
}
#d5i {
  background: url(http://lorempixel.com/100/600/nature/5/);
}
#d6i {
  background: url(http://lorempixel.com/100/600/nature/6/);
}
#d7i {
  background: url(http://lorempixel.com/100/600/nature/7/);
}
#d8i {
  background: url(http://lorempixel.com/100/600/nature/8/);
}
#d9i {
  background: url(http://lorempixel.com/100/600/nature/9/);
}
#d10i {
  background: url(http://lorempixel.com/100/600/nature/10/);
}

#d2::-webkit-scrollbar {
    width: 16px;
}
#d2::-webkit-scrollbar-track {
    background: #cccccc; 
    XXborder-radius: 5px;
}
#d2::-webkit-scrollbar-thumb {
    XXborder-radius: 5px;
    background: gray;
}

/* perfect scrollbar - always visible: */
.ps-container,
.ps-scrollbar-x-rail, .ps-scrollbar-x,
.ps-scrollbar-y-rail, .ps-scrollbar-y {
  opacity: 1 !important;
}

/* stylying jScrollPane: */
.jspTrack,.jspDrag {
  border-radius: 8px;
}
.jspVerticalBar {
  background: none;
}
              
            
!

JS

              
                $(function () {
  var ua = window.navigator.userAgent;
  //$('#d1i').text('Native: ' + ua)
 
  $('#d3').jScrollPane({
    //showArrows: true,
    horizontalGutter: 30,
			verticalGutter: 30
      
    });
  
  
  
  $('#d4')
  .css('position','absolute')
  .css('overflow','hidden')
  .perfectScrollbar();
  
  $('#d5')
  //.css('position','absolute')
  //.css('margin-left','140px') // ???
  .niceScroll({autohidemode:false});
  
  $('#d6').mCustomScrollbar({
    axis:"yx",
					//theme:"3d",
					scrollInertia:550,
    scrollbarPosition:"outside"
  });
  
  $('#d7').lionbars();
  
  $('#d8').scroller();
  
  // errors:
  //$('#d9').tinyscrollbar();
  
  $('#d10').addClass('tse-scrollable');
  $('#d10i').addClass('tse-content');
  $('#d10').TrackpadScrollEmulator();
  
});

              
            
!
999px

Console