L
L
lahomie932018-07-14 22:49:14
css
lahomie93, 2018-07-14 22:49:14

Why is the font from Google Fonts not connected to Wordpress?

Hello! I need to include a Google font for a Wordpress site. I want to do it in the "Additional Styles" section with code like this:

@font-face {
font-family: 'PT Sans', sans-serif;
src:url('https://fonts.googleapis.com/css?family=PT+Sans');
font-weight: normal;
}

.description-block {
  font-size: 14px;
  font-family: 'PT Sans';
  color: rgb( 0, 0, 0 );
}

.description-block h4 {
  font-size: 18px;
  margin-bottom: 20px;
}

The description-block class correctly styles the wrapped elements, but for some reason the fonts are not loaded. Tell me what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Yanchevsky, 2018-07-14
@lahomie93

Hello.
If you want to connect via css, then replace

@font-face {
font-family: 'PT Sans', sans-serif;
src:url('https://fonts.googleapis.com/css?family=PT+Sans');
font-weight: normal;
}

on the
@import url('https://fonts.googleapis.com/css?family=PT+Sans');

Z
zorca, 2018-07-14
@zorca

Because the url must have a font, and you have a style in which all font-faces are already registered. Connect as Google recommends and don't do gag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question