Home » Wordpress » Cannot change the font using font-family in WordPress

Cannot change the font using font-family in WordPress

Posted by: admin November 27, 2017 Leave a comment

Questions:

I am new to wordpress and web development. I would like to modify a theme in wordpress but I have a problem. I tried to override the font-family using style.css in the editor, but it doesn’t seem to help.
I wrote the following:

html, body {
    font-family: Gafata;
}

It doesn’t override the original code. What could be my next steps in resolving the problem?Thank you very much in advance!

Answers:

Put this at the top of your CSS.

@import url("http://fonts.googleapis.com/css?family=Gafata");

If you are not getting the font at that point update your

html, body {
font-family: Gafata;
}

to

html, body {
font-family: Gafata!important;
}

You could use class names on your html, and body tags. If you do not want to use !important.

Like

html.someClass, body.someOtherClass {
font-family: Gafata;
}

Other useful info https://developers.google.com/fonts/docs/getting_started

Leave a Reply

Your email address will not be published. Required fields are marked *