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.


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.


  p Any grid-parent over 10 child items has a "SHOW MORE" button to expand
  p Click "SHOW MORE" to see the results
  each val in [5,8,10,13,16,19]
    h3=val+" child elements"
      - for (var x = 0; x < val; x++)
      .btn-expand Show More


                body {
  background-color: #EEF0ED;
  margin-bottom: 300px;
.grid-parent {
  margin: 20px;
  width: 250px;
  background-color: lightgrey;
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  max-height: 100px;
  // height: 100px;
  position: relative;
    // height: auto; // You can opt to use height over max-height, has subtle differences on 5 or less elements
    max-height: none;
    // overflow: none; // Not necessary
  background-color: blue;
  width: 50px;
  height: 50px;
  box-sizing: border-box;
  border: 1px solid red;
    background-color: lightblue;
.btn-expand {
  display: none;
  z-index: 3;
  position: absolute;
  right: 0px;
  bottom: 0px;
  padding: 3px;
  background-color: red;
  color: white;
.btn-show {
  display: block;



                // Overflow boolean checker
function isOverflown(element){
  return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;

// Jquery Toggle Text Plugin
$.fn.toggleText = function(t1, t2){
  if (this.text() == t1) this.text(t2);
  else                   this.text(t1);
  return this;

// Toggle Overflow
function toggleOverflow(e){"grid-parent--showall");
  $("Show More", "Show LESS");

// Where stuff happens
var parents = document.querySelectorAll(".grid-parent");

parents.forEach(parent => {
    parent.lastElementChild.addEventListener('click', toggleOverflow);