Home >Web Front-end >CSS Tutorial >How Can I Import Google Web Fonts into My CSS Without HTML Access?
Importing Google Web Fonts in CSS Files Without HTML Access
When working with a CMS where you have restricted access to the HTML document, it can be challenging to import Google web fonts. However, there is a method within CSS that allows you to achieve this:
@import Method:
Use the @import directive as follows:
@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');
Replace "Open Sans" with the name of your desired font. URL-encode any spaces in the font name by adding a " " sign between each word.
Additional Considerations:
Google Fonts Customization:
Google Fonts provides an automated option to generate the @import directive for you: