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 How to Make a Website HTML First Create the Content Containers

How can I display/show image file path to use in code

I have tried searching my Mac's "help", dragging and dropping the image to text editor's file path, and have tried adding the ".." to the code to bypass part of the file tree: these have not worked.

7 Answers

Hi Lee Ann VanWinkel,

To begin, there is no href in an img tag. your code should look something like this:

<img src="Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">

Also, if the image is not in the same directory as the file calling for it you will have to specify this. Examples would be:

<img src="img/Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">

to go down one directory to the img directory, or:

<img src="../Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'">

to up one directory. Also, I would avoid using blank spaces in file and directory names.

Jeff

I may go back to the start of the lessons to view the code there, although it would be nice to know the coommand to view the image path.

Matias Valenzuela
Matias Valenzuela
7,554 Points

Submit the code to see what is the problem please

Alright, but this is code referring to an image in my personal images, so it does not tell you whether the path is correct:

 <img src=img/culture.concert hall.jpg" alt="Seating and ornate ceilings inside of a formal concert hall">  
        <img src=a href="..Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>
<img src=a href="..Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>

also incorrect: ````

<img src=a href="Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>

Matias Valenzuela
Matias Valenzuela
7,554 Points

You have to use at the beginning and end

Can you clarify? What am I using at the beginning and end? Thx.

Matias Valenzuela
Matias Valenzuela
7,554 Points

Use (```) Markdown cheatsheet or nobody will be able to read your code

Michael Wiss
Michael Wiss
19,233 Points

On a Mac you can control + click on your image, look under "get info" and it should reveal it's path.

file paths and leaving out a ; or end are my most common and maddening mistakes

Michael ~ I can get info but not the file path per se, so I need to see the path and how it relates to my text editor.

Thx Jeff. This is also not working:

        <img src="../Portland Art Museum logo.jpg" alt="Portland Art Museum logo 'experience the power of art'"><br>

Considering I don't know where the file is in relation to the file calling for it I can't really help you with the path. What I will suggest is putting the image file in the same directory for now. Also, make sure the capitalization is the same. And, I would rename the file without spaces. With a little work I'm sure you'll figure it out.

Craziness! After much labor (intermittently for a day or so), I did get my first image to load!
I was able to drag and drop to my desktop so that the image was in the same directory in that sense, at least.