Using Web Fonts: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "Category:CSS Category:Web Development == Web font formats == {| !format !extension !description !target platform |- |eot |`.eot` | | |- |woff |`.woff` | | |- |tru...")
 
No edit summary
Line 1: Line 1:
[[Category:CSS]] [[Category:Web Development]]
[[Category:CSS]] [[Category:Web Development]]
== Implementation ==
First add the fonts themselves with the `@font-face` rule:
<syntaxhighlight lang="css">
@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 */
}
</syntaxhighlight>
Then the font maybe references as a value for the `font-family` property:
<syntaxhighlight lang="css">
p {
font-family: 'MyWebFont', sans-serif;
}
</syntaxhighlight>


== Web font formats ==
== Web font formats ==

Revision as of 00:17, 21 November 2015

Implementation

First add the fonts themselves with the @font-face rule:

@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 */
}

Then the font maybe references as a value for the font-family property:

p {
	font-family: 'MyWebFont', sans-serif;
}

Web font formats

format extension description target platform
eot .eot
woff .woff
truetype .ttf
svg .svg

Examples

Links

Resources

Notes