Home > Blockchain >  Font on CSS won't load
Font on CSS won't load

Time:07-27

I was trying to use google fonts on CSS for my webpage but instead of rendering the chosen font, it showed the default sans-serif font. What changes could I make to the code?

h1 {
  font-family: 'Montserrat-Black', sans-serif;
  font-size: 3rem;
  line-height: 1.5;
}
<link href="https://fonts.googleapis.com/css2?family=Montserrat" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Ubuntu" rel="stylesheet">

<h1>test</h1>

CodePudding user response:

As I understood, you want to use the Black version of Montserrat. Here is how you can do it:

font-family: 'Montserrat', sans-serif;
font-weight: 400; /* This value changes from font to font. It's like a value of its boldness */
font-weight: bold; /* That's a way too */

CodePudding user response:

First way: For using black version of this font you can import just black version:

<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap" rel="stylesheet">

In this way, for using Black version of Montserrat you can just set font-family: 'Montserrat', sans-serif;

Second way: Also you can import all versions and Give font-weight: 900; to every where you wanna be black version.

.............

If you need just black version, do first way. Else second.

  • Related