treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] CSS @import fonts

  • So I have a css file with all the @font-face blocks in it to keep them in one place and transfer them to save space. Anyhow, im trying to use @import to put it into other css files so I can access the fonts from within. Only problem is - you guessed it - its not working. Im assuming either @import was never intended for this kind of thing or im using it wrong, either way any help is appreciated.

  • Let's call your @font-face file fonts.css.

    Let's call your importer file style.css.

    To be clear, if you copy/paste the code in fonts.css into style.css everything works.

    But if you have a line instead of the code in style.css saying:

    @import url('fonts.css');
    

    It doesn't work?

  • Fixed now - spelling error - had me going for ages