I'm gathering that this is a Chrome bug, which is interesting because I am using a version of Chromium and it works fine. I would recommend using internal CSS (rather than external stylesheets) underneath a <style>
tag in your <head>
section (where you should also reference the <link>
to the font), and adding the CSS assigned to *
, as shown below, to it:
* {
-webkit-font-smoothing: antialiased;
}
body {
font-family: 'Montserrat', sans-serif;
}
h1 {
font-size: 3.5rem;
font-family: 'Montserrat', sans-serif;
font-weight: 900;
line-height: 1.5;
}
h3 {
font-size: 1.5rem;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Ubuntu&display=swap" rel="stylesheet">
</head>
<body>
<h1>Title</h1>
<h3>Title</h3>
</body>
Alternatively, there is also the @import
method, which you should find greyed out as the right-hand option in the Embed section of the Google Fonts link. This should be your secondary option, however, because, as @igriorik notes here, these rules defer the loading of the included resource until the file is fetched, which could lead to broken fonts on some platforms.
To do this, though, you would add the @import rules underneath a <style>
tag, and reference it in the desired element. In your case (with the Montserrat font):
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
body {
font-family: 'Montserrat', sans-serif;
}
h1 {
font-size: 3.5rem;
font-family: 'Montserrat', sans-serif;
font-weight: 900;
line-height: 1.5;
}
h3 {
font-size: 1.5rem;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
<h1>Title</h1>
<h3>Title</h3>
Let me know if this doesn't work!