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="wrapper">
  <div class="example">
    <h1>Aliquam gravida</h1>
    
    <p>
      Fusce semper id arcu id porttitor. Etiam sed quam vel ante laoreet varius at sed purus. Morbi commodo est nec felis tempor sollicitudin. Aliquam gravida nunc quis vestibulum volutpat. Sed quis dui sodales, congue risus vel, blandit lectus. In porta odio purus, id posuere tortor viverra vel. Etiam nunc quam, rutrum non diam eu, cursus tincidunt lorem.
    </p>
    
  </div>
  
  <div class="range">
    <span class="range__min"></span>
    <span class="range__container"></span>
    <span class="range__max"></span>
  </div>
</div>
            
          
!
            
              @font-face {
  font-family: AmstelvarVF;
  font-display: swap;
  src: url(https://yoksel.github.io/variable-fonts/assets/fonts/AmstelvarAlpha/AmstelvarAlpha-VF.ttf) format("truetype");
}

HTML, BODY {
  display: flex;
  min-height: 100%;
  width: 100%;
}

BODY {
  display: flex;
  justify-content: center;
  align-items: center;
  font: 16px/1.4 Trebuchet MS, Arial, sans-serif;
}
.wrapper {
  max-width: 500px;
  margin: 0 30px;
  text-align: center;
}

.example {
  font-family: AmstelvarVF;
  
  H1 {
    margin: 0 0 .25em;
    font-size: 50px;  
  }
  
  p {
    max-height: 110px;
    overflow: hidden;
  }
}

.range {
  margin-top: 32px;
  padding: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ececec;
  border-radius: 5px;
}

.range__container {
  margin: 0 10px;
  display: flex;
  align-items: center;
}

.range__input {
  cursor: pointer;
}
            
          
!
            
              const config = {
  min: 10,
  max: 72,
  name: 'opsz',
  fullName: 'Optical size',
  step: 1
};

const wrapper = document.querySelector('.wrapper');
const rangeContainer = document.querySelector('.range__container');
const rangeMin = document.querySelector('.range__min');
const rangeMax = document.querySelector('.range__max');
const example = document.querySelector('.example');

const rangeInput = document.createElement('input');
rangeInput.classList.add('range__input');
rangeInput.type = 'range';
rangeInput.min = config.min;
rangeInput.max = config.max;
rangeInput.step = config.step;
rangeInput.value = rangeInput.min;

setVariation(rangeInput.value);

rangeMin.innerHTML = rangeInput.min;
rangeMax.innerHTML = rangeInput.max;
rangeContainer.appendChild(rangeInput);

rangeInput.addEventListener('input', function() {
  setVariation(this.value);
});

function setVariation(val) {
  example.style['font-variation-settings'] = `"wdth" 400, "wght" 70, "${config.name}" ${val}`;
}
            
          
!
999px
Loading ..................

Console