<main role="main">
		<p id="changingText" class="fn-text">Variable Font Demo</p>
			<aside class="fn-horizontal">
				<label for="fontStretch">font-stretch:</label>
				<span id="fontStretchOutput"></span>
				<div class="rangecontainer">
					<input type="range" id="fontStretch" name="fontStretch" min="75" max="125">
				</div>
			</aside>
</main>
@font-face {
 font-family: "Venn VF";
  src: url("https://redonion.se/codepen/fonts/Venn_VF.woff2") format("woff2-variations"), 
      url("https://redonion.se/codepen/fonts/Venn_VF.woff2")format("woff2");
  font-stretch: 75% 125%;
}

body {
  font-size: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; 
  font-family: "Venn VF", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

p {
  --fontStretch: 100%;
  font-stretch: var(--fontStretch);
}

main {
  height: 200px;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 1em;
  box-sizing: border-box;
}

aside {
  margin: 0;
}

input {
  background: #642240;
}

.rangecontainer {
  width: 100%;
  line-height: 0;

  input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1.5em;
    background-color: #642240;
    opacity: 0.8;
    transition: opacity 0.2s;
    outline: transparent;
    border-radius: 0.75em;
    box-shadow: inset 0 2px 4px rgba(62, 21, 40, 0.84);
  }

  input:hover {
    opacity: 1;
  }

  input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 2em;
    height: 2em;
    background: #fff9f1;
    cursor: pointer;
    border-radius: 1em;
    box-shadow: 0 1px 4px darken(#642240, 10%);
  }

  input::-moz-range-thumb {
    width: 2em;
    height: 2em;
    background: #fff9f1;
    cursor: pointer;
    border-radius: 1em;
    box-shadow: 0 1px 4px darken(#642240, 10%);
  }
}

.fn-text {
  margin: auto;
  color: #6b505a;
}

.fn-horizontal {
  margin: 0 auto 1.5em;
  max-width: (1220/16) + em;
  display: flex;
  align-items: center;
  width: 100%;

  label,
  span {
    color: #6b213c;
    white-space: nowrap;
    margin-right: 10px;
  }

  span {
    margin-right: 1em;
    font-weight: 700;
  }
}
View Compiled
    function printValue(slider, output, clay, varName, suffix) {
        const input = document.getElementById(slider);
        const print = document.getElementById(output);
        const result = document.getElementById(clay);

        print.innerHTML = input.value;

        input.oninput = function () {
            print.innerHTML = this.value;
            result.style.setProperty(varName, this.value + suffix);
        };
    } 

    printValue("fontStretch", "fontStretchOutput", "changingText", "--fontStretch", "%");

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.