Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML how to use different fonts

Tags:

html

fonts

if i place my ttf font file in my websites root folder lets say named AMC.tff and in my website use <font face="AMC"> is it going to work... if not than what is the method to use unusual fonts in your website

like image 756
Moon Avatar asked Dec 29 '22 07:12

Moon


1 Answers

You can include True Type Fonts with the help of the CSS 3 property @font-face. The following CSS would apply your AMC font to all <h1/> tags:

@font-face {
  font-family: "AMC";
  src: url("./AMC.ttf") format("truetype");
}
h1 {
  font-family: "AMC", sans-serif;
}

For browsers that have no support for webfonts you should specify a similar alternative to your font. In the above example sans-serif would be used if AMC cannot be found because the @font-face tag was not recognized by the browser.

like image 55
stefanglase Avatar answered Jan 11 '23 08:01

stefanglase