Pen Settings



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


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.


  <h3>This is a long text string that needs to be truncated to a shorter number of lines. For some reason we just have these really long article titles and they need to stop.</h3>
  <div class="excerpt">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut laoreet neque, ut posuere libero. Etiam ut ultrices mi. Donec dictum ultricies justo, vitae molestie nunc finibus ac. Morbi rutrum nunc massa, id eleifend mauris dignissim non. Pellentesque eu turpis mi. Maecenas sed nulla at massa rutrum condimentum. Pellentesque varius mi in libero vulputate, quis cursus purus consequat. Nunc sit amet arcu at nulla interdum volutpat. Nunc ut pellentesque massa. Etiam tempor nulla vel iaculis tempus. Nulla tristique pellentesque viverra. <a href="#" class="readmore">Read More</a></div>


                h3 {
  font-family: 'Shadows Into Light', cursive;
  line-height: 36px;
  font-size: 36px;
  margin-top: 0;
  font-weight: normal;

body {
  font-family: 'Dosis';
  font-size: 16px;
  background-color: lightpink;

article {
  margin: 20px;
  background-color: white;
  box-shadow: 5px 5px 5px rgba(black, 0.2);
  padding: 40px;


                $.fn.truncate = function (lines, readmore) {
  lines = typeof lines !== 'undefined' ? lines : 1;
  readmore = typeof readmore !== 'undefined' ? readmore : '.readmore';
  var lineHeight = window.lineHeight(this[0]);
  if (this.attr('title')) {
  if (!this.attr('data-link') && this.find('a'+readmore).length > 0) {
    this.attr('data-link', this.find('a'+readmore)[0].outerHTML);
  var link = this.attr('data-link');
  if (this.height() > lines * lineHeight) {
    if (!this.attr("title")) {
      this.attr("title", this.html());
    var words = this.attr("title").split(" ");
    var str = "";
    var prevstr = "";
    for (var i = 0; i < words.length; i++) {
      if (this.height() > lines * lineHeight) {
        this.html(prevstr.trim() + "&hellip; " + (typeof link !== 'undefined' ? ' ' + link : ''));
      prevstr = str;
      str += words[i] + " ";
      this.html(str.trim() + "&hellip;" + (typeof link !== 'undefined' ? ' ' + link : ''));
    if (this.height() > lines * lineHeight) {
      this.html(prevstr.trim() + "&hellip; " + (typeof link !== 'undefined' ? ' ' + link : ''));
  return this;

$(window).on('load resize', function() {
  $('h3').each(function() {
  $('.excerpt').each(function() {