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

Esteban Ruseler
Esteban Ruseler
1,686 Points

Please help. Trying to move from local host to FTP server - wrong HTML code

I have a website ready to go but I cant FTP it. The index (HTML) loads fine but the CSS isn't loading.

In my local host I had

<link rel="stylesheet" href="file://localhost/Users/esteban/Documents/z/style.css" type="text/css" media="screen">

So I've changed it to

<link rel="stylesheet" href="style.css" type="text/css" media="screen">

But it doesnt work, I've also tried href="file://style.css"

I know this is probably a silly question but it's so frustrating to be falling over the last hurdle.

If anyone can help, I'd be really grateful :)

5 Answers

Make sure the css is in your root director (The same one your index.html is in) and also make sure it's included in the <head> element of your document.

John Wheal
John Wheal
27,969 Points

You don't need the file:// part of the link.

Just use href="style.css". This will work as long as the css is in the same folder as index.html

Esteban Ruseler
Esteban Ruseler
1,686 Points

John Wheal That's what I thought. I had the css style, normalise, grid.css all in the same "level" but then what worked was putting it all in a file folder and uploading that. Thanks for your help :)

James Barnett
James Barnett
39,199 Points

Esteban Ruseler -

> what worked was putting it all in a file folder

As your website grows you'll want to organize your images, CSS & HTML into separate folders. Here's a tutorial where you can read more about how to organize your files

Esteban Ruseler
Esteban Ruseler
1,686 Points

Graham Saunders Thank you so much. I basically had to create a file folder and upload that to the server. So it worked, my first website is live :))

Esteban Ruseler
Esteban Ruseler
1,686 Points

James Barnett Thanks for this, I found it really useful.

(Apologies for the delayed response. I was travelling.)