cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
  <h1>Automatic Quotes</h1>
  <p>This is a test on a simple way to use the data-attribute to deligate a snippet of text to quickly and easily use as a blockquote or pullquote.<p>
  <p>This is a nice way to keep your HTML a bit more DRY. <span data-quote>DRY! DRY! DRY!</span> Boy it's late! It's like 4am. Why am I still awake? Surely I could've waited and done this in the morning.</p>
  <p>Anyways, there's two ways to achive this. Version 1: You can simply clone the 'span[data-quote]' element and add a class and then append or prepend it to the nth-child. Version 2 uses wrapInner() to create a blockquote around the text.</p>
  <p>You could go even further and create an extensive selection of attributes: data-blockquote, data-pullquote, data-left-quote, data-right-quote etc. Once you're css is right you could have unlimited options with ease.<p>
</div>
            
          
!
            
              @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Cinzel+Decorative:900);
@import url(https://fonts.googleapis.com/css?family=Gudea);

*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

body {
  background-color: hsl(190, 40, 50%);
}

.container {
  margin: 0 auto;
  max-width: 40em;
  text-align: justify;
}

h1 {
  font: {
    family: "Cinzel Decorative",Georgia, serif;
    size: 4em;
  }
  text-align: center;
}

p {
  font-family: "Gudea", sans-serif;
}

// Version 1
.quote {
  font: {
      family: Georgia, serif;
      size: 2em;
      style: italic;
  }
  // background-color: hsl(50, 50, 85%);
  color: white;
  float: left;
  text-align: right;
  margin-right: 0.5em;
  max-width: 9.5em;
  padding: 0.5em;
}

.quote::before {
  content: "\201C";
}

.quote::after {
  content: "\201D";
}

// Version 2
// TODO: style blockquote
            
          
!
            
              $(document).ready(function() {
  // Version 1
  $('span[data-quote]').clone().prependTo('p:nth-child(3)').addClass('quote');
  
  // Version 2
  /**
   * More specific slection using 'nth' pseudo 
   * selector
   * Use wrapInner() to wrap the textnode in a 
   * traditional blockquote
   */
  /*$('span[data-quote]').clone().prependTo('p:nth-child(2)').wrapInner('<blockquote />');*/
});


            
          
!
999px
Loading ..................

Console