Skip to main content

Custom Font

  font: italic small-caps 400 1.2rem/2 'Montserrat', sans-serif;

the order will be as below:

  /* 
font: font-style font-variant font-weight font-size/line-height font-family;
*/
  • font-size and font-family should be there in the short-hand

Generic Families & Font Families

image

Font Display

image

Block PeriodSwap PeriodOutcome
blockshortinfiniteFOIT, Layout shifts
swapnoneinfiniteFOUT, Layout shifts
fallbackextremely shortshortMinimize the risk of layout shift & invisible texts
optionalextremely shortnoneMinimize the risk of layout shift & invisible texts(even better than fallback, as no swap period)
autobased on user agentbased on user agentbased on user agent
  1. Controlling Font Performance with font-display
  2. Font loading strategies: FOIT and FOUT
    • FOIT - Flash Of Invisible Text
    • FOUT - Flash Of Unstyled Text
  3. Optimize web fonts loading - YouTube
@font-face {
font-family: 'Belta bold';
src: url('../fonts/belta-bold-cufonfonts/belta-regular.ttf');
src: url('../fonts/belta-bold-cufonfonts/belta-regular.woff2') format('woff2'),
url('../fonts/belta-bold-cufonfonts/belta-regular.woff') format('woff'),
url('../fonts/belta-bold-cufonfonts/belta-regular.otf') format('opentype'),
url('../fonts/belta-bold-cufonfonts/belta-regular.ttf') format('truetype'),
url('../fonts/belta-bold-cufonfonts/belta-regular.eot') format('embedded-opentype');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Belta bold';
src: url('../fonts/belta-bold-cufonfonts/belta-light.ttf');
font-weight: 300;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Belta bold';
src: url('../fonts/belta-bold-cufonfonts/belta-bold.ttf');
font-weight: bold;
font-style: normal;
font-display: swap;
}

Summary

image