Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

@fontface fails when I move html file to a different folder?

I'm having the oddest issue. I have an html file that is linked to a css stylesheet with the following:

@font-face {
    font-family: Weirdfont;
    src: url(fonts/weirdfont.ttf);
    font-weight:400;
}

The html works fine in the root folder: /weirdphrases.com/shirt1.html

But once I move the html to: /weirdphrases.com/t-shirts/shirt1.html

The font breaks down. Everything else in the css file works, but the font just fails once I move the html to a different folder. Is there any reason why this might happen? I tried all kinds of things, front slightly different syntax with font-family (Weirdfont to 'Weirdfont', etc.)

I'll upload the project if this is not specific enough to guess at the issue. Thanks!

1 Answer

Garrett Levine
Garrett Levine
20,305 Points

It shouldn't be an issue with you moving your HTML file, as the font is linked in your CSS. When you move your HTML are you also moving your CSS? If so, then the URL will no longer work, and you will have to re-adjust it to something like

'../../../fonts/weirdfont.ttf'

hope that helps!

It doesn't seem so... it's odd, I uploaded it online, and the issue fixed itself. However, my marquee tag disappeared completely... why would a website look differently online vs. locally? Thanks

For the marquee tag issue, the site is located at: http://luisdominguez.xyz/temp/t-shirts/random-is-the-new-plan.html

Thanks! And css at http://luisdominguez.xyz/temp/stylesheet.css