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 id="app">
  <article class="content">
    <h1 class="content-title">Urna Cursus</h1>
    <main class="content-body">
      <p>Habitasse platea dictumst quisque sagittis purus sit. Ac feugiat sed lectus vestibulum mattis ullamcorper. Ultricies mi quis hendrerit dolor magna eget est lorem ipsum.</p>
      <p>Adipiscing tristique risus nec feugiat in fermentum. Faucibus turpis in eu mi bibendum. Integer quis auctor elit sed vulputate mi. Urna nunc id cursus metus aliquam eleifend mi in. <span v-pq:left.italic.quoted.highlighted>Cras tincidunt lobortis feugiat vivamus at augue eget. Eget felis eget nunc lobortis mattis aliquam faucibus. Netus et malesuada fames ac turpis.</span></p>
      <p>Dui faucibus in ornare quam viverra. Orci phasellus egestas tellus rutrum tellus pellentesque eu. Lacus sed turpis tincidunt id. Mollis nunc sed id semper. Dictum at tempor commodo ullamcorper. Faucibus scelerisque eleifend mi in. Enim nec dui nunc mattis enim ut tellus elementum sagittis. Purus viverra accumsan in nisl nisi scelerisque eu ultrices.</p>
      <p>Dictumst quisque sagittis purus sit. Amet venenatis urna cursus eget. Volutpat consequat mauris nunc congue nisi vitae suscipit tellus. <span v-pq:right="'Add abbreviated pull quotes by adding strings as expressions to the v-pq directive.'">A custom, abbreviated message can also be shown instead of a selected text fragment, just by adding the message string as an expression to the directive. For example, an abbreviated pull-quote will be shown instead of this unnecessarily long pull-quote source.</span></p>
      <p>Sit amet cursus sit amet dictum sit. Non blandit massa enim nec dui nunc mattis enim. Ornare arcu odio ut sem nulla pharetra diam sit. Faucibus ornare suspendisse sed nisi lacus sed viverra.</p>
      <p>Ullamcorper dignissim cras tincidunt lobortis feugiat vivamus. Arcu odio ut sem nulla pharetra diam. Lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit amet. Vestibulum lectus mauris ultrices eros. Est ullamcorper eget nulla facilisi. Sed euismod nisi porta lorem mollis.</p>
      <p>At consectetur lorem donec massa sapien faucibus et molestie ac. <span v-pq:center>Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Urna condimentum mattis pellentesque id nibh tortor id aliquet lectus.</span> Ac tortor dignissim convallis aenean et tortor. Pellentesque elit eget gravida cum sociis natoque penatibus et magnis. Sit amet facilisis magna etiam tempor orci eu lobortis.</p>
      <p>Tortor at auctor urna nunc id cursus metus. Pulvinar elementum integer enim neque volutpat. Vestibulum morbi blandit cursus risus at ultrices mi. Neque laoreet suspendisse interdum consectetur.</p>
      <p>Non blandit massa enim nec dui nunc mattis enim ut. In vitae turpis massa sed elementum tempus egestas sed. Mauris vitae ultricies leo integer malesuada nunc vel risus. Pellentesque eu tincidunt tortor aliquam nulla facilisi. Commodo sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Mattis vulputate enim nulla aliquet porttitor lacus luctus accumsan. Morbi tristique senectus et netus.</p>
      <p>Auctor neque vitae tempus quam pellentesque nec nam. Nisl rhoncus mattis rhoncus urna neque viverra justo. Nisi scelerisque eu ultrices vitae auctor eu augue. Sodales neque sodales ut etiam sit amet nisl. Mus mauris vitae ultricies leo. Tincidunt ornare massa eget egestas purus viverra accumsan in nisl. Venenatis lectus magna fringilla urna porttitor rhoncus dolor purus. Gravida dictum fusce ut placerat orci nulla pellentesque dignissim enim.</p>
      <p>Sit amet purus gravida quis blandit turpis. Ultrices eros in cursus turpis. Lorem ipsum dolor sit amet consectetur adipiscing elit pellentesque. Diam vel quam elementum pulvinar etiam non quam lacus suspendisse. Viverra accumsan in nisl nisi. Gravida arcu ac tortor dignissim convallis aenean. Elementum nibh tellus molestie nunc non blandit. Ut ornare lectus sit amet. Feugiat vivamus at augue eget arcu dictum varius duis. Felis eget nunc lobortis mattis. Adipiscing enim eu turpis egestas pretium aenean pharetra.</p>
    </main><!-- .content-body -->
  </article><!-- .content -->
</div><!-- #app -->
              
            
!

CSS

              
                /* Set default sizing for font and boxes */
:root {
  font-size: 21px;
  box-sizing: border-box;
}

/* Keep the browser edges little distant */
#app {
  padding: 2em;
}

/* 
 * The Box-sizing hack
 *
 * @link: https://w3bits.com/box-sizing-reset/
 */
*, *:before, *:after {
  box-sizing: inherit;
}

/* Set the basic text properties */
body {
  font: 1em/1.8 Outfit, sans-serif;
  color: #444;
}

/* Add a little bit more spacing to paragraphs */
p:not(:last-child) {
  margin-bottom: 1.5em;
}

/* Align the content to the center of the page */
.content {
  margin-inline: auto;
  max-width: 640px;
}

.content-title {
  text-align: center;
}

/* Add the basic cosmetics for the pull quote */
.pulled-quote {
  font-size: 1.1em;
  font-weight: bold;
  display: block;
  text-align: center;
  color: #999;
  padding-block: 1em;
  margin-block: 1.5em;
}

/* Add quotes to the pull quote  */
.pulled-quote--quoted:before {
  content: open-quote;
}
.pulled-quote--quoted:after {
  content: close-quote;
}

/* Add a darker color shade to pull quote */
.pulled-quote--highlighted {
  color: #111;
}

@media only screen and (min-width: 1024px) {
  /* 
   * Add width to the pull quote except for 
   * when it's center-aligned
   */ 
  .pulled-quote:not(.pulled-quote--center) {
    width: 300px;
  }

  /*
   * Add suitable spacing and alignment to the 
   * left and right aligned pull quotes
   */ 
  .pulled-quote--right {
    float: right;
    margin: 0 -200px 0 0;
    padding: 0 0 1.5em 1.5em;
    text-align: left;
  }

  .pulled-quote--left {
    float: left;
    margin: 0 0 0 -200px;
    padding: 0 1.5em 1.5em 0;
    text-align: right;
  }
}

/* Highlight the pull quote sources temporarily */
p span:not([class]) {
  color: orange;
  background-color: lightyellow;
}
              
            
!

JS

              
                const app = Vue.createApp({});

// Add a pull quote directive 
app.directive("pq", {
  
  mounted(el, binding) {

    // Add a clone of `el` to the parent node
    var elParent = el.parentNode
    var elClone = el.cloneNode(true)
    elParent.prepend(elClone)
    
    /*
     * Apply the `.pull-quote` CSS class to the cloned 
     * element.
     */
    elClone.classList.add("pulled-quote")
        
    /*
     * Add the directive expression as the abbreviated
     * content for the pull quote.
     */ 
    if(binding.value) {
      elClone.innerHTML = binding.value
    }
    
    /*
     * Add some alignment arguments to the `v-pq`
     *
     * For eg. v-on:right, v-on:center. The v-on:left 
     * will be the default behavior of `v-pq`.
     */
    switch(binding.arg) {
      case 'right':
        elClone.classList.add("pulled-quote--right")
        break
      case 'center':
        elClone.classList.add("pulled-quote--center")
        break
      default:
        elClone.classList.add("pulled-quote--left")
        break
    }

     /*
     * Add some text-formatting modifiers to the `v-pq`
     *
     * For eg. v-on:right.italic, 
     * v-on:center.highlighted.   
     */
    if(binding.modifiers.italic) {
      elClone.style.fontStyle = "italic"
    }
    
    if(binding.modifiers.quoted) {
      elClone.classList.add("pulled-quote--quoted")
    }
    
    if(binding.modifiers.highlighted) {
      elClone.classList.add("pulled-quote--highlighted")
    }
  }
})

app.mount("#app");

              
            
!
999px

Console