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 class="text-wrapper vh-100 d-flex align-items-center justify-content-center">
  <div class="text">Eum voluptatem magnam <strong>ut</strong> <strong> dolores</strong><strong> optio</strong> ea commodi amet ut dicta dignissimos et sequi eligendi <strong>cum exercitationem odio</strong> ab dicta enim.</div>
</div>
              
            
!

CSS

              
                body {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 300;
  font-size: 3.5vw;
}

strong {
  font-weight: 700;
  display: inline-block;
}

.text-container {
  width: 75vw;
}

              
            
!

JS

              
                var mySplitText = nestedLinesSplit(".text", { type: "lines" });

var tl = new TimelineLite();

tl.staggerFrom(mySplitText.lines, 1, { x: 800 }, 2);

//magical function
function nestedLinesSplit(target, vars) {
  var split = new SplitText(target, vars),
    words = vars.type.indexOf("words") !== -1,
    chars = vars.type.indexOf("chars") !== -1,
    insertAt = function (a, b, i) {
      //insert the elements of array "b" into array "a" at index "i"
      var l = b.length,
        j;
      for (j = 0; j < l; j++) {
        a.splice(i++, 0, b[j]);
      }
      return l;
    },
    children,
    child,
    i;

  if (typeof target === "string") {
    target = document.querySelectorAll(target);
  }
  if (target.length > 1) {
    for (i = 0; i < target.length; i++) {
      split.lines = split.lines.concat(nestedLinesSplit(target[i], vars).lines);
    }
    return split;
  }

  //mark all the words and character <div> elements as _protected so that we can identify the non-split stuff.
  children = (words ? split.words : []).concat(chars ? split.chars : []);
  for (i = 0; i < children.length; i++) {
    children[i]._protect = true;
  }

  children = split.lines;
  for (i = 0; i < children.length; i++) {
    child = children[i].firstChild;
    //if the first child isn't protected and it's not a text node, we found a nested element that we must bust up into lines.
    if (!child._protect && child.nodeType !== 3) {
      children[i].parentNode.insertBefore(child, children[i]);
      children[i].parentNode.removeChild(children[i]);
      children.splice(i, 1);
      i += insertAt(children, nestedLinesSplit(child, vars).lines, i) - 1;
    }
  }
  return split;
}

              
            
!
999px

Console