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.


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.


                <!DOCTYPE html>
<html lang="en">

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Flexible Full-Width “Justified” Text Blocks</title>

  <blockquote class="text-block">
    <span class="text-line">You can’t stay</span>
    <span class="text-line">in your corner</span>
    <span class="text-line">of the Forest</span>
    <span class="text-line">waiting for others</span>
    <span class="text-line">to come to you</span><span class="append">.</span>
    <span class="text-line">You have to</span>
    <span class="text-line">go to them sometimes</span><span class="append">.</span>
		    <span class="text-line">  —Winnie the Pooh</span>



                body {
  display: flex;
  font-family: Montserrat, sans-serif;
  margin: 0;
  min-height: 100vh;

cite {
  font-stretch: condensed;
  font-style: normal;
  font-weight: bold;

.text-block {
  display: grid;
  grid-template-columns: max-content 1fr;
  margin: auto;
  text-transform: uppercase;
  width: max-content;

.text-block cite {
  display: flex;
  grid-column: 1;
  justify-content: space-between;

.text-block .append {
  align-self: end;
  grid-column: 2;


                // Compiles a node list of indiviual lines inside text blocks
var lines = document.querySelectorAll(".text-line");

// Compiles a node list of elements appended to the ends of lines
var appendages = document.querySelectorAll(".append");

// Wraps each character of a string inside a `<span>` element
var wrapCharacters = function(lines) {
  return lines.forEach(function(line) {
    var characters = line.innerHTML.split("");
    var wrappedCharacters = characters
      .map(function(character) {
        if (character === " ") {
          return '<span class="text-line">&nbsp;</span>';
        return '<span class="text-line">' + character + "</span>";
    return (line.innerHTML = wrappedCharacters);

// Sets an element’s font size based on its previous sibling
var useSiblingFontSize = function(elem) { =;

// Measures the length of each line and sets its font size accordingly
var setFontSize = function(elems) {
  return elems.forEach(function(elem) {
    if (!elem.classList.contains("append")) {
      return ( = 120 / elem.innerHTML.length + "vw");
    return useSiblingFontSize(elem);

var formatTextBlocks = function() {