<main role="main">
			<p id="changingText" class="fn-text">Variable Font Demo</p>
			
			<aside class="fn-horizontal">
					<label for="fontWeight">font-weight:</label>
					<span id="fontWeightOutput"></span>
					<div class="rangecontainer">
						<input type="range" id="fontWeight" name="fontWeight" min="300" max="800">
					</div>

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

					<label for="fontSize">font-size:</label>
					<span id="fontSizeOutput"></span>
					<div class="rangecontainer">
						<input type="range" id="fontSize" name="fontSize" min="8" max="148">
					</div>
			</aside>

		</main>
@font-face {
 font-family: "Venn VF";
  src: url("https://redonion.se/codepen/fonts/Venn_VF.woff2") format("woff2-variations"), // for Safari
      url("https://redonion.se/codepen/fonts/Venn_VF.woff2")format("woff2"); // for all other supporting browsers
  font-display: fallback;
  font-weight: 300 800; // prevents faux bolding in Safari
  font-stretch: 75% 125%;
}

body {
  font-size:1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; //Setting this CSS property will fix the ‘too heavy’ font issue on Firefox on Mac:
  font-family: "Venn VF", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

p {
  --fontSize: 78px;
  font-size: var(--fontSize);
  --fontWeight: 550;
  font-weight: var(--fontWeight);
  --fontStretch: 100%;
  font-stretch: var(--fontStretch);
}

//STYLING FOR EXAMPLE
main {
  height: 100vh;
  width: 100%;
  background-color: antiquewhite;

  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  padding: 1em;
  box-sizing: border-box;
}

aside {
  margin: 0;
}

input {
  background: linear-gradient(
    to right,
    #642240 0%,
    #f42534 100%
  ); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
}

.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 {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  margin: auto;
  color: #6b505a;
}

.fn-horizontal {
  grid-column: 1 / 2;
  margin: 0 auto 1.5em;
  max-width: (1220/16) + em;
  display: grid;
  grid-template-columns: (116/16) + em auto 1fr;
  align-items: center;
  grid-row-gap: 1.5em;
  width: 100%;

  label,
  span {
    color: #6b213c;
  }

  span {
    margin-right: 1em;
    font-weight: 700;
  }
} //rangewrap
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

    printValue("fontWeight", "fontWeightOutput", "changingText", "--fontWeight", "");
    printValue("fontStretch", "fontStretchOutput", "changingText", "--fontStretch", "%");
    printValue("fontSize", "fontSizeOutput", "changingText", "--fontSize", "px");

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.