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 id="test">
  <p>
    Short test para
  </p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu bibendum at varius vel pharetra. Sagittis nisl rhoncus mattis rhoncus urna neque viverra. Magna ac placerat vestibulum lectus. Accumsan sit amet nulla facilisi. Odio tempor orci dapibus ultrices. Ut tellus elementum sagittis vitae. Et netus et malesuada fames ac turpis egestas sed tempus. Velit euismod in pellentesque massa placerat duis. Libero justo laoreet sit amet cursus sit amet dictum.</p>
  <p>Et ligula ullamcorper malesuada proin libero nunc consequat. Iaculis at erat pellentesque adipiscing commodo elit. Lectus arcu bibendum at varius vel. Sodales neque sodales ut etiam sit amet nisl purus. Ut tortor pretium viverra suspendisse potenti. Vivamus arcu felis bibendum ut tristique. At imperdiet dui accumsan sit amet nulla. Imperdiet proin fermentum leo vel orci porta non pulvinar. Accumsan lacus vel facilisis volutpat est velit egestas dui id. Quis eleifend quam adipiscing vitae proin sagittis. Diam volutpat commodo sed egestas egestas fringilla phasellus faucibus.</p>
  <p>Volutpat ac tincidunt vitae semper. Feugiat scelerisque varius morbi enim nunc. Congue quisque egestas diam in arcu. Malesuada nunc vel risus commodo. Urna condimentum mattis pellentesque id nibh tortor id aliquet. Tellus orci ac auctor augue mauris augue neque gravida. Libero nunc consequat interdum varius. Viverra adipiscing at in tellus integer. Magna fringilla urna porttitor rhoncus. Sit amet luctus venenatis lectus magna fringilla urna.</p>
</div>
<div>
  <p>Adipiscing elit pellentesque habitant morbi. Maecenas ultricies mi eget mauris pharetra. Tortor condimentum lacinia quis vel. Odio ut enim blandit volutpat maecenas volutpat blandit aliquam. Morbi leo urna molestie at elementum eu facilisis sed. Ultrices vitae auctor eu augue ut lectus. Justo donec enim diam vulputate. Risus commodo viverra maecenas accumsan lacus vel facilisis. Integer quis auctor elit sed. Amet consectetur adipiscing elit duis tristique sollicitudin.</p>
</div>
              
            
!

CSS

              
                #test {
  background-color: blueviolet;
}

              
            
!

JS

              
                $(document).ready(function () {
  var testParas = $("#test").find("p");
  testParas.each(function () {
    $(this).text(truncate($(this).text()));
  });
});

function truncate(text) {
  var maxLength = 329;
  var textSplit = text.split(" ");
  var textArr = [];
  if (text.length <= maxLength) {
    return text;
  } else {
    for (var i = 0; textArr.join(" ").length <= maxLength; i++) {
      textArr.push(textSplit[i]);
    }
    return `${textArr.join(" ")}...`;
  }
}

              
            
!
999px

Console