Put a particular font on an element

Hello everybody :slight_smile:,

I want to change the font of an element with roboto-light-tff, the main font of the html page it’s roboto black. But in my css folder I also downloaded Roboto-light-tff.

I don’t understand why the police don’t change :frowning:
Thank you for your help.

@font-face {

font-family: “Roboto”;

src: url("/Public/Font/Roboto/Roboto-Black.ttf") format(“truetype”);

}
cc

Did you specify the font-family on an actual element (e.g. body, p, etc.)

Yes like this font-family : roboto
font-weight : 100;

It’s not correct ?
For this roboto-light-tff ?
I want use for element p with class.

If you just want the Roboto font why not use the web font version from google fonts?


If you open the dev tools (F12) you can look at the network tab to see if you are linking to the fonts correctly. One thing I can see that might be an issue is if you are not serving the page but just opening it in the browser the root-relative path / might fail. You can serve the page in VS Code using the Live Server extension, or you can try using ./ instead of/ for the starting path.

OK , thank you , I will check. :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.