Posted By: Anonymous
I’m working with a CMS which I only have access to the CSS file. So, I can’t include anything thing in the HEAD of the document. I was wondering if there was a way to import the web font from within the CSS file?
Obviously, “Open Sans” (
Open+Sans) is the font that is imported. So replace it with yours. If the font’s name has multiple words, URL-encode it by adding a
+ sign between each word, as I did.
Make sure to place the
@import at the very top of your CSS, before any rules.
Google Fonts can automatically generate the
@import directive for you. Once you have chosen a font, click the
(+) icon next to it. In bottom-left corner, a container titled “1 Family Selected” will appear. Click it, and it will expand. Use the “Customize” tab to select options, and then switch back to “Embed” and click “@import” under “Embed Font”. Copy the CSS between the
<style> tags into your stylesheet.