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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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="page-content">
    <form class="" action="#">
    <select id="js-apply-size">
      <option value="small-copy">small width</option>
      <option value="medium-copy" selected>medium width</option>
      <option value="big-copy">full width</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 precentage-wise – scale window
  </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>

  <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; //px
$baseElementSize: 640; // px

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

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

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

.sprite:before {
  	content: "";
    display: inline-block;

    .transitions-enabled & {
      transition: 0.4s;    
    }
}

.sprite-1:before {
    /* Diamond: 64 × 64 px */
		width: (64/$baseElementSize*100%);
		padding-top: (64/$baseElementSize*100%);
		height: 0;
    background-position: 0 0;
    background-size: (600/64*100%) auto; /* spritemap size ÷ sprite size × 100% */
}

.sprite-2:before {
    /* Circle: 64 × 64 px */
		width: (64/$baseElementSize*100%);
    padding-top: (64/$baseElementSize*100%);
		height: 0;
    background-size: (600/64)*100% auto; /* spritemap size ÷ sprite size × 100% */
    background-position: ((150)/(600-64)*100%) 0; /* (sprite offset) ÷ (spritemap size - sprite size) × 100% */

}

.sprite-3:before {
    /* Aldus Leaf, green: 26 × 27 px */
		width: (26/$baseElementSize*100%);
		padding-top: (27/$baseElementSize*100%);
    height: 0;
    background-size: (600/26)*100% auto; /* spritemap size ÷ sprite size × 100% */
    background-position: 0 ((150)/(450-27)*100%); /* (sprite offset) ÷ (spritemap size - sprite size) × 100% */
}

.sprite-4:before {
    /* Aldus Leaf, red: 26 × 27 px */
		width: (26/$baseElementSize*100%);
		padding-top: (27/$baseElementSize*100%);
    height: 0;
    background-size: (600/26)*100% auto; /* spritemap size ÷ sprite size × 100% */
    background-position: ((150)/(600-26)*100%) ((150)/(450-27)*100%); /* (sprite offset) ÷ (spritemap size - sprite size) × 100% */
}

.sprite-5:before {
    /* Edmond O'Brien in “D.O.A.” (1949): 100 × 140 px */
		width: (100/$baseElementSize*100%);
		padding-top: (140/$baseElementSize*100%);
    height: 0;
    background-size: (600/100)*100% auto; /* spritemap size ÷ sprite size × 100% */
    background-position: ((300)/(600-100)*100%) 0; /* (sprite offset) ÷ (spritemap size - sprite size) × 100% */
    margin-right: 0.4em;
}

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

.text-content {
  width: 90%;
  margin: 0 auto;
  line-height: 1.4em;
  position: relative;
  
  &.transitions-enabled {
    transition: 0.6s;
  }
}

.small-copy {
  font-size: 0.8em;
  max-width: 40%;
}

.medium-copy {
  font-size: 1em;
  max-width: 64%;
}

.big-copy {
  font-size: 1.4em;
  max-width: 90%;
}

.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
Loading ..................

Console