How to use a custom font for specific headings in the Impulse theme?

Hello

I have uploaded a custom font to my Asset folders.

How do i use it now for some of my heading ( like footer title) but not all headings.

I am using the Impulse theme

Thanks

1 Like

@TBS2022

Step 1

Download the webfont version of your font. The font files must include at least the WOFF and WOFF2 file types (TTF or OTF are not a webfont file types).

Step 2

From your Shopify Admin go to Online Store > Themes > next to the theme you want to edit click Actions > Edit Code. In the sidebar choose Assets > theme.scss.liquid**.** Scroll to the bottom of the file and paste the following code…

@font-face {
font-family: "NAME OF FONT";
src: url("NAME-OF-FONT-FILE.woff2") format("woff2"),
url("NAME-OF-FONT-FILE.woff") format("woff");
}

Replace NAME OF FONT with the name of your font and NAME OF THE FONT FILE with the exact name (case sensitive with hyphens) of the font file on your computer.

Below this code also pastes the following code…


yourcssselectorhere { font-family: "NAME OF FONT"!important; }

Step 3

Go to the Assets folder and click Add a new asset. Upload each version of the font file one by one.

Step 4

Now that the font is installed, using code we need to tell the theme what headings or text will use our new font. In a new browser tab go to your website and find the heading or text you want in this font, in this example it is a heading. Right-click on the words and select Inspect.

A window will pop up showing you the code of the site. Look in the right-hand column for the CSS code that is styling your heading. In the example above you will see on the left, highlighted in grey, the heading is an

and on the right the CSS property selector for the heading is h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6. Click the property name and copy the text.

Go back to the browser tab with the theme code editor and open the theme.scss.liquid file again. Select the words that say “your CSS selector here” and paste what you have already copied. Then replace “NAME OF YOUR FONT” with the name you used before.

Save your changes, refresh your website and have a look at your custom font.

Thanks!

Not sure i did it correctly as nothing is happening

I am not sure that i did the code right

@font-face {
font-family: “Druk-Bold-Web”;
src: url(“Druk-Bold-Web.woff2”) format(“woff2”),
url(“Druk-Bold-Web.woff”) format(“woff”);
}

.h4, { { font-family: "Druk-Bold-Web"!important; }