VVWdefect
VVWdefect

Reputation: 151

HTML using unknown font


I downloaded a font which I would like to use on a webpage. Of course this font isn't installed on the user's computer. How can I let a user's computer display that font? (I thought is was called: embedding a font but I could be wrong)

Thx for any help
VVW

Upvotes: 2

Views: 1276

Answers (3)

David Thomas
David Thomas

Reputation: 253318

If the users have a relatively new/up-to-date browser:

@font-face {
  font-family: font-name
  src: url(path/to/font.ttf);
}

element {
  font-family: font-name;
}

First, we add the @font-face declaration wherein we specify the path, filename, and font-family name for our custom font. Then we add the font choice in a CSS rule to our...element.1

Citation:

  1. A List Apart: Taking Advantage of HTML5 and CSS3 with Modernizr.

References:

Upvotes: 2

thirtydot
thirtydot

Reputation: 228162

You need to use @font-face.

A very easy way to generate the required cross-browser CSS and different formats of font file is to use:

http://www.fontsquirrel.com/fontface/generator

You simply upload your font and the generator does all the hard work.

Upvotes: 2

marsbear
marsbear

Reputation: 1459

You are right that is called font-embedding. Here is what you need: Embedding fonts in CSS

Upvotes: 0

Related Questions