Add HTML code
The following example demonstrates how to embed Google Font code and declare custom heading classes that override the current stylesheet.
Step 1: Choose a Google font
-
Visit the Google Fonts site and choose the font family that you want to use.
-
Copy the generated code that is to be embedded in the
<head>
section of the page and paste it temporarily into a text editor.- Embed Font code
- CSS Rule
-
Add the font-family rule to each heading class, enclosing the heading classes in a
<style>
tag.This code is pasted into Page Builder.
<style> h1 {color: teal; font-family: 'Khand', sans-serif; } h2 {color: teal; font-family: 'Khand', sans-serif; } h3 {color: teal; font-family: 'Khand', sans-serif; } </style>
Step 2: Add the code to the page
-
In the Admin sidebar of your store, go to Content > Elements > Pages.
-
Find the page where the font is to be available and open it in edit mode.
-
Scroll down and expand the Content section.
-
In the Page Builder panel, expand Elements and drag an HTML Code placeholder to a row, column, or tab set on the stage.
Use the red guideline to position the divider either before or after another content container in the row, column, or tab set.
-
Hover over the HTML container to display the toolbox and choose the Settings (
), icon. -
In the text box, paste the embed Google Fonts code and style declarations that you prepared.
To make it easier to read, you can enter a few spaces to indent the code.
-
Update the remaining settings as needed (see Change HTML code settings for details).
-
In the upper-right corner, click Save to apply the settings and return to the Page Builder workspace.
The new font renders when the page is viewed through a browser.