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

Bob Sutherton
Bob Sutherton
20,160 Points

Question about file structure and a strange occurrence with the CSS stylesheet.

I am building a website for someone and the content right now is just interviews, each one being several pages. I put each interview into a separate folder, except for the first one which I did which I happened to leave "freehanging" in the main section of the folder.

So, getting to my question. I recently did the third interview today. It is in it's own folder. I backed out of the folder with

 ../css/interview.css

So, it works fine on that interview. But I noticed that when I tried to pull up the other two interviews in my browser the CSS styles were no longer applying. I have checked the paths and they seem okay so I am confused. This wasn't happening before.

Also, I used a new text editor called "Brackets", which is pretty cool but did have a strange issue saving the files when the file folder was opened. Could this text editor have done something to make my CSS file not show up in the other two interviews all of the sudden?

I'm very confused because the CSS is showing up in one place and not showing up in the other, where it was showing up before.

My file structure is basic:

main folder
     css folder
     img folder
     interview3 folder
     interview2 folder
  interviewA.html (interview 1 is in the main folder)
  interviewB.html
  interviewC.html
etc.

3 Answers

Philip Cox
Philip Cox
14,818 Points

Hi James. To be honest, I think this is a convoluted folder structure, that will not scale well for you. Personally, I would have a project directory, with an interview and css folder. Keep all your interview .html documents in the interview directory, and your css doc in css directory. This way, your file path for your css will definitely be the same. Brackets, is a very nice editor, if you're not using Sublime text. It has some great features; live-reload, inline css amendment.

On another note, have you tried PHP yet? It sounds like it would work well with this project. You could create your header and footer, and include them above and below each of your interviews.

:)

Bob Sutherton
Bob Sutherton
20,160 Points

I agree with you that the file structure is not ideal. I was planning to reorganize it a little later. But the mystery of why some files weren't displaying the CSS remains. Right now, since I don't have anything else to go on, I will have to assume that it had something to do with "Brackets" and I won't be using that editor anymore.

When I emailed myself the same files, and redownloaded them onto another computer that didn't have brackets, the files showed up fine. Also, on the original computer, when I opened up brackets and erased the file path and put it back in (the exact same path), it worked. But then the links to the page stopped working. Just really strange behavior.

Anyway, I am now on a different computer and everything is back to normal. So I am really baffled by this.

Bob Sutherton
Bob Sutherton
20,160 Points

Okay, so it seems that now since I have made one small change in the CSS (in notepad++), the CSS has now disappeared again.

Bob Sutherton
Bob Sutherton
20,160 Points

I am taking your advice and rearranging the file structure, but I am still baffled. To answer your question about PHP, I have not tried it yet. Thanks for the tip though. I am doing the web developer track. I think PHP is somewhere in there, I just haven't gotten to it yet.