How to use a custom font on an html site

In order to use a custom font on an html site, you can use the CSS feature named @font-face. Note that it may not work on older browsers. See w3schools for details.

Here is how you use it, add these lines in your css file:

@font-face { font-family: myOwnFont; src: url('myOwnFont-Roman.ttf'); } @font-face { font-family: myOwnFont; font-weight: bold; src: url('myOwnFont-Bold.ttf');}

Then, simply call it using font-family:

p {font-family: myOwnFont; } .

Comments

Popular Posts