Documentation
Feedback
Guides
Storefront Development

Storefront Development
Store FrameworkStylingCustomizing your store’s typography
Customizing your store’s typography

Effectively communicating with users requires careful consideration of your store's typography. It serves as a visual representation of your store's identity through distinctive styles, encompassing factors like font size and spacing.

For additional information on customizing your store’s typography using the CMS, refer to the Customizing your store’s typography guide.

Before you begin

Before following this guide, ensure that you:

  • Review the Best practices for using CSS handles article.
  • Set up the Assets builder in your Store Theme app's manifest.json file.
  • Set up the Styles builder to version 2.x in your Store Theme app's manifest.json file. Note that previous versions of the Styles builder do not support the customization outlined in this guide.
manifest.json

_10
builders{
_10
...
_10
"assets": "0.x",
_10
"styles": "2.x"
_10
}

Instructions

  1. Open your Store Theme app in your preferred code editor.
  2. Create a new folder named fonts within the assets directory.
  3. Place the font files inside the assets/fonts/ folder. Ensure font files have the extensions: .ttf or .woff.
  4. In the styles/configs folder, create a new file named font-faces.css.
  5. Use the @font-face rule to declare the desired CSS properties for your website's typography. For example:
font-faces.css

_10
@font-face {
_10
font-family: 'MyHelvetica';
_10
src: url(assets/fonts/MyHelvetica.woff2), url(assets/fonts/MyHelvetica.ttf);
_10
font-weight: bold;
_10
}

Fonts uploaded on the Assets Builder can be referenced in your CSS files by specifying their file path in the src property.

Using font faces

The font-faces.css file is a global configuration. Utilize the declared font faces using the font-family property to specify the desired font for a particular component. Here's an example:

styles/configs/font-faces.css

_17
@font-face {
_17
font-family: "Roboto";
_17
font-style: normal;
_17
font-weight: 400;
_17
src: local("Roboto"), local("Roboto-Regular"),
_17
url("assets/fonts/roboto-v20-latin-regular.woff2") format("woff2"),
_17
url("assets/fonts/roboto-v20-latin-regular.woff") format("woff");
_17
}
_17
_17
@font-face {
_17
font-family: "Roboto";
_17
font-style: normal;
_17
font-weight: 500;
_17
src: local("Roboto Medium"), local("Roboto-Medium"),
_17
url("assets/fonts/roboto-v20-latin-500.woff2") format("woff2"),
_17
url("assets/fonts/roboto-v20-latin-500.woff") format("woff");
_17
}

styles/css/vtex.minicart.css

_10
.closeIconContainer::before {
_10
content: "My cart";
_10
font-size: 24px;
_10
line-height: 32px;
_10
font-family: Roboto;
_10
color: #000;
_10
font-weight: 500;
_10
}

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page