Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created May 16, 2018 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeaVerou/7fc3668ee1780483034852738f873ed5 to your computer and use it in GitHub Desktop.
Save LeaVerou/7fc3668ee1780483034852738f873ed5 to your computer and use it in GitHub Desktop.
Variable fonts for non-variable weights across sizes.
/**
* Variable fonts for non-variable weights across sizes.
*/
@import url('https://variablefonts.monotype.com/MetaVariableDemo-Set.css');
span {
display: block;
font-size: calc(var(--size, 1) * 100%);
xfont-weight: calc(100 + var(--size, 1) * 100);
font-weight: 200
}
span:nth-child(1) { font-weight: 200; }
span:nth-child(2) { font-weight: 100; }
span:nth-child(3) { font-weight: 180; }
h1 {
text-align: center;
text-transform: uppercase;
font: 1800%/.85 FF Meta VF, sans-serif;
margin: 4rem;
}
<h1>
<span style="--size: .32">Awesome</span>
<span style="--size: 1">CSS</span>
<span style="--size: .4">Secrets</span>
</h1>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment