123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <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
            
          
!
            
                  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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console