How can I use Google's Roboto font on a website?

前端 未结 13 882
旧巷少年郎
旧巷少年郎 2020-12-12 10:23

I want to use Google\'s Roboto font on my website and I am following this tutorial:

http://www.maketecheasier.com/use-google-roboto-font-everywhere/2012/03/15

<
13条回答
  •  Happy的楠姐
    2020-12-12 11:02

    it's easy

    every folder of those you downloaded has a different kind of roboto font, means they are different fonts

    example: "roboto_regular_macroman"

    to use any of them:

    1- extract the folder of the font you want to use

    2- upload it near the css file

    3- now include it in the css file

    example for including the font which called "roboto_regular_macroman":

    @font-face {
    font-family: 'Roboto';
    src: url('roboto_regular_macroman/Roboto-Regular-webfont.eot');
    src: url('roboto_regular_macroman/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('roboto_regular_macroman/Roboto-Regular-webfont.woff') format('woff'),
         url('roboto_regular_macroman/Roboto-Regular-webfont.ttf') format('truetype'),
         url('roboto_regular_macroman/Roboto-Regular-webfont.svg#RobotoRegular') format('svg');
    font-weight: normal;
    font-style: normal;
    }
    

    watch for the path of the files, here i uploaded the folder called "roboto_regular_macroman" in the same folder where the css is

    then you can now simply use the font by typing font-family: 'Roboto';

提交回复
热议问题