Sometimes, we want to add a Google Font to a Vue.js component.
In this article, we’ll look at how to add a Google Font to a Vue.js component.
How to add a Google Font to a Vue.js component?
To add a Google Font to a Vue.js component, we can imnport it in our CSS.
For instance, we write
@import url("https://fonts.googleapis.com/css?family=Roboto+Condensed");
html,
body {
font-family: "Roboto", sans-serif;
}
#app {
font-family: "Roboto", sans-serif;
}
in the style
tag of a component to import the Roboto font with
@import url("https://fonts.googleapis.com/css?family=Roboto+Condensed");
Then we can set the font-family
to Roboto
in the elements we want.
Conclusion
To add a Google Font to a Vue.js component, we can imnport it in our CSS.