Skip to content

Instantly share code, notes, and snippets.

@djordjecupic
Last active April 10, 2018 07:32
Show Gist options
  • Save djordjecupic/b3b22617132d8a12aff219067e229435 to your computer and use it in GitHub Desktop.
Save djordjecupic/b3b22617132d8a12aff219067e229435 to your computer and use it in GitHub Desktop.
Formal syntax for @font-face
@font-face {
[ font-family: <family-name>; ] ||
[ src: [ <url> [ format(<string>#) ]? | <font-face-name> ]#; ] ||
[ unicode-range: <urange>#; ] ||
[ font-variant: <font-variant>; ] ||
[ font-feature-settings: normal | <feature-tag-value>#; ] ||
[ font-variation-settings: normal | [ <string> <number>] # ||
[ font-stretch: <font-stretch>; ] ||
[ font-weight: <weight>; ] ||
[ font-style: <style>; ]
}
where
<family-name> = <string> | <custom-ident>+
<feature-tag-value> = <string> [ <integer> | on | off ]?
Example for deep Browser support:
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
body {
font-family: 'MyWebFont', Fallback, sans-serif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment