Search
 
SCRIPT & CODE EXAMPLE
 

CSS

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 -->
Comment

how to add font otf format in html

/*default version*/
@font-face {
	font-family: 'lovelyFont';
	src: url('fonts/lovely_font.eot'); 
	src: 
		local('Lovely Font'),
		local('Lovely-Font'),
		url('fonts/lovely_font.otf') 
		format('opentype');
}
/*bold version*/
@font-face {
	font-family: 'lovelyFont';
	src: url('fonts/lovely_font_bold.eot'); 
	src: 
		local('Lovely Font Bold'),
		local('Lovely-Font-Bold'),
		url('fonts/lovely_font_bold.otf') 
		format('opentype');
	font-weight: bold;
}
/*container element*/
div { font-family: 'lovelyFont', sans-serif; }
/*span elements inside the container div*/
span { font-weight: bold; }
Comment

how to choose font in html

font-family:
Comment

PREVIOUS NEXT
Code Example
Css :: font gap css 
Css :: how to set a div size to full screen 
Css :: create a animation name in css 
Css :: responsive font-size 
Css :: css margin top 
Css :: how to set div background image 
Css :: css n number of lines only 
Css :: object-fit 
Css :: how to make multiple borders using box shadow in css 
Css :: Install css-loader and style-loader 
Css :: css position fixed center 
Css :: css border width 
Css :: border image css 
Css :: canvas disable antialiasing 
Css :: div color overlay css 
Css :: child css 
Css :: glassmorphism in css 
Css :: change input placeholder text css 
Css :: use css in cshtml 
Css :: liste decoration css 
Css :: superscript css 
Css :: how to rotate image in css 
Css :: css for background color 
Css :: how to align border to center in css 
Css :: force css style in angular 
Css :: how to use local fonts in css 
Css :: SassError: Top-level selectors may not contain the parent selector "&" 
Css :: css background overlay 
Css :: text change animation css 
Css :: rotate animation css 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =