css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="page-content">
    <form class="" action="#">
    <select id="js-apply-size">
      <option value="small-copy">small copy</option>
      <option value="medium-copy" selected>medium copy</option>
      <option value="big-copy">big copy</option>
    </select>
    <select id="js-apply-sprite">
      <option value="sprite-1" selected>Sprite #1 – Green Spade</option>
      <option value="sprite-2">Sprite #2 – Red Circle</option>
      <option value="sprite-3">Sprite #3 – Aldus Leaf, green</option>
      <option value="sprite-4">Sprite #4 – Aldus Leaf, red</option>
      <option value="sprite-5">Sprite #5 – Edmund O'Brien</option>
    </select>
    <select id="js-apply-spritemap">
      <option value="spritemap-svg" selected>SVG</option>
      <option value="spritemap-png-hi">PNG ×2</option>
      <option value="spritemap-png-lo">PNG lo-res</option>
    </select>
    <input id="js-enable-transitions" type="checkbox" value="transitions-enabled" checked="checked"> <label for="js-enable-transitions">transitions</label>
  </form>
<div class="text-content spritemap-svg transitions-enabled medium-copy">
  <div class="author">
    <span class="sprite sprite-1"></span>Scaling via font size – change copy size
  </div>
  
  <p>Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular.</p>
  
  <ol>
    <li><a href="https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap.svg">SVG spritemap</a></li>
        <li><a href="https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap-144dpi.png">retina PNG spritemap</a></li>
        <li><a href="https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap-144dpi.png">low-quality PNG spritemap</a></li>
  </ol>

  <p>Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.</p>
</div>
</div>

            
          
!
            
              $baseFontSize: 18;

.spritemap-svg .sprite:before {
    background-image: url('https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap.svg'); /* 600 × 450 px */  
}

.spritemap-png-hi .sprite:before {
    background-image: url('https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap-144dpi.png'); /* 600 × 450 px */  
}

.spritemap-png-lo .sprite:before {
    background-image: url('https://ssl-account.com/stolzenhain.net/content/archive/2015/1-responsive-spritemaps/spritemap-36dpi.png'); /* 600 × 450 px */  
}

.sprite:before {
  	content: "";
    display: inline-block;
    background-size: (600/$baseFontSize)+em;
  
    .transitions-enabled & {
      transition: 0.4s;    
    }
}

.sprite-1:before {
    /* Diamond: 64 × 64 px */
		width: (64/$baseFontSize)+em;
		height: (64/$baseFontSize)+em;
    background-position: 0 0;
}

.sprite-2:before {
    /* Circle: 64 × 64 px */
		width: (64/$baseFontSize)+em;
		height: (64/$baseFontSize)+em;
    background-position: (-150/$baseFontSize)+em 0;
}

.sprite-3:before {
    /* Aldus Leaf, green: 26 × 27 px */
		width: (26/$baseFontSize)+em;
		height: (27/$baseFontSize)+em;
    background-position: 0 (-150/$baseFontSize)+em;
}

.sprite-4:before {
    /* Aldus Leaf, red: 26 × 27 px */
		width: (26/$baseFontSize)+em;
		height: (27/$baseFontSize)+em;
    background-position: (-150/$baseFontSize)+em (-150/$baseFontSize)+em;
}

.sprite-5:before {
    /* Edmond O'Brien in “D.O.A.” (1949): 100 × 140 px */
		width: (100/$baseFontSize)+em;
		height: (140/$baseFontSize)+em;
    background-position: (-300/$baseFontSize)+em 0;
    margin-right: 0.4em;
}

body {
  font-size: $baseFontSize+px;
  font-family: sans-serif;
  line-height: 1.4em;
}

.text-content {
  width: 90%;
  margin: 0 auto;
  line-height: 1.4em;
}

.small-copy {
  font-size: 0.8em;
  max-width: 520px;
}

.medium-copy {
  font-size: 1em;
  max-width: 640px;
}

.big-copy {
  font-size: 1.4em;
  max-width: 720px;
}

.author {
    margin-bottom: 1em;  
}

form {
  text-align: center;
  margin-bottom: 2em;
}

input,
select {
  margin: 0 0.4em;
}

            
          
!
            
              $(function(){
  
  var classLookup = {
    'apply-size' : 'medium-copy',
    'apply-spritemap' : 'spritemap-svg',
    'enable-transitions' : 'transitions-enabled'
  }
  
  function updateClasses() {
    var setClasses = [];
    for (var key in classLookup) {
      if (classLookup.hasOwnProperty(key)) {
        setClasses.push(classLookup[key]);
      }
    }
    $('.text-content').attr('class', 'text-content '+setClasses.join(' '));
  }
    
  $('#js-apply-sprite').on('change',function(){
    var setClass = $(this).find(':selected').attr('value');
    $('.sprite').attr('class', 'sprite '+setClass);
  });
  
  $('#js-apply-size').on('change',function(){
    classLookup['apply-size'] = $(this).find(':selected').attr('value');
    updateClasses();
  });
  
  $('#js-apply-spritemap').on('change',function(){
    classLookup['apply-spritemap'] = $(this).find(':selected').attr('value'); 
    updateClasses();
  });
  
  $('#js-enable-transitions').on('change',function(){
    classLookup['enable-transitions'] = $(this).filter(':checked').attr('value') || 'transitions-disabled'; 
    updateClasses();
  });

});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console