Mike Pierce
Mike Pierce

Reputation: 1534

How do you specify webfonts outside each HTML file?

In my current setup, I have this line in the <head> of each of my webpages to load a webfont.

<link href="https://fonts.googleapis.com/css?family=Roboto+Slab" rel="stylesheet">

But this has to be on every webpage. What if I want to change fonts across the site? Can I put an analogous line in the CSS file? How can I specify the font(s) for my website in one place instead of in each HTML file?

Upvotes: 1

Views: 29

Answers (1)

Nisharg Shah
Nisharg Shah

Reputation: 19582

If you have one CSS file for your entire website, you can use the @import statement.

@import url('https://fonts.googleapis.com/css?family=Roboto+Slab');

Upvotes: 2

Related Questions