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

HTML

Putting quotes around my values in Text Editor makes my links not work... Any idea why?

I am working through the Web Design track, and alongside the lessons, I am practicing my code in Text Editor on a Mac.

When I try to reference an image using relative path in Treehouse's workstation, like this...

<img src="file-name.jpg">

...the images show up in my preview just fine.

But when I tried to do the same thing in Text Editor on my Mac, the images would not show up. With a little testing, I figured out that when I removed the quotations around the file name (and actually any link in my code), suddenly the images worked. It looked like this:

<img src=file-name.jpg>

Any idea why there is this discrepancy in code?

Thanks!

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

I'm not sure to be honest.

The only reasson I can think of is that if the code was copied from an external source it can sometimes leave "traces" in the text that your text editor might have picked up. If you copied the code over from your workspace area (and I've no reason to think you have, really) then it might have done this when you pasted it into your text editor.

To stop this, what I do is copy the text into Notepad (I use Windows) and the copy the text from there which should leave the text completely clean and clean so the code shouldn't do any weird things like removing or using the wrong quote characters.

But again, this is just guesswork on my part, but there's some sort of character conflict going on, I think.

Yeah, I can't figure out the reason either. Maybe the answer will come to light the further along I go.

Thanks for answering, Jonathan!