Skip to content

Instantly share code, notes, and snippets.

@ten1seven
Created May 23, 2012 17:18
Show Gist options
  • Save ten1seven/2776468 to your computer and use it in GitHub Desktop.
Save ten1seven/2776468 to your computer and use it in GitHub Desktop.
How to use font weight with web fonts
@font-face {
font-family: 'MyFont';
src: url('path-to-normal-font');
...
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'MyFont';
src: url('path-to-bold-font');
...
font-weight: 700;
font-style: normal;
}
body {
font-family: MyFont, fallbackfont;
}
.normal-text {
font-weight: 400;
}
.bold-text {
font-weight: 700;
}
@ten1seven
Copy link
Author

This allows you to specify a font fallback and still use the correct bold or normal version either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment