Answers for "use custom fonts html"

1

use font on website html

<style type="text/css">
@font-face {
    font-family: "My Custom Font";
    src: url(http://www.example.org/mycustomfont.ttf) format("truetype");
}
p.customfont { 
    font-family: "My Custom Font", Verdana, Tahoma;
}
</style>
<p class="customfont">Hello world!</p>
Posted by: Guest on October-05-2020
0

add custom font to html

<style>
  /* include the font here using @font-face */
  @font-face {
    font-family: 'myFontName'; /* this value can be anything you wish - it gets used in the class definition below */
    src: url('path/to/font/myfont.woff'); /* add the file path to your font here */
  }
  
  /* define a class and add the new font */
  #customFont {
   	font-family: myFontName; /* property value must match value in @font-face*/ 
  }
</style>

<div>
  <!-- To use the custom font, simply add your new class to the element -->
  <p id="customFont">Hello, World!</p>
</div>

<!-- Happy coding <3 -->
Posted by: Guest on April-26-2022

Browse Popular Code Answers by Language