Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

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

CSS

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

JS

              
                    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");
              
            
!
999px

Console