Ask coding questions

← Back to all posts
How could I add custom fonts into my game / website
JustScorpion (2)

For the past few days, I've been working on a website/game using HTML, CSS, JS. And when using this I wanted to use custom fonts to personalize the writing. Can anyone please explain to me how to use custom fonts Inside Of Repl.It


Willard21 (274)

Same way you add custom fonts to any webpage.

        @font-face {
		font-family: 'Montserrat';
		font-style: normal;
		font-weight: 400;
		src: url(/fonts/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2) format('woff2');
		unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
		font-display: swap;

Then use the font called 'Montserrat' in your code like any other font. This is an example obviously. I just copied it from a google fonts style sheet.