W
W
webfln2018-03-06 17:46:25
css
webfln, 2018-03-06 17:46:25

How to set font priority in css?

Hello. We use the Roboto font on our project, which is connected via google fonts.
css:
font-family: Roboto, sans-serif;
The browser selects the first font from the list that is installed or can be downloaded using the @font-face rule.
But if the user already has the Roboto font installed, then the browser will not take the font through font-face, but will take the font from his device.
This is where the problem we run into comes in. The user may have a crooked font installed, or its old version (it is not clear why this happened), and the font itself is displayed differently.
How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
webfln, 2018-03-06
@webfln

Revealed the problem. When fonts are included via google-fonts, it uses the local parameter, which is why the font from the
src system is loaded first: local('Roboto Light'), local('Roboto-Light'), url( https://fonts.gstatic. com/s/roboto/v18/KFOlCnqEu92... format('woff2');

D
Dima, 2018-03-06
Dolgoter @DDolgy

try uploading your font and set @font-face to a different font-family

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question