Ex.: Assuming we have in the index.html head a link tag to the google font, eg: .
In an external index.css file we have declared something like: :root { --jos: 'josefin slab'; } .
Then in the web component's style we could do: :host { font-family: var(--jos) }
But I believe you don't want the google font declared in the outside index.html file, so in the WC style we could do something like:
@import url("fonts.googleapis.com/css?family=Jo...);
:host { font-family: "Josefin Slab"; }
That would work.
This isn't working for me, I can only get the font to load if I put the font <link> in the html <head>
<link>
<head>
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ex.: Assuming we have in the index.html head a link tag to the google font, eg:
.
In an external index.css file we have declared something like:
:root {
--jos: 'josefin slab';
} .
Then in the web component's style we could do:
:host {
font-family: var(--jos)
}
But I believe you don't want the google font declared in the outside index.html file, so in the WC style we could do something like:
@import url("fonts.googleapis.com/css?family=Jo...);
:host {
font-family: "Josefin Slab";
}
That would work.
This isn't working for me, I can only get the font to load if I put the font
<link>
in the html<head>