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 trialChalin Russell
1,129 PointsI do not understand how you where the current file name logo.png how in this exercise do you find the current file name
I googled the answer but I had written as <img src= "../img/index.html" alt="site logo"> I thought index.html is the current file
<!DOCTYPE html>
<html>
<head>
<title>Portfolio Page</title>
</head>
<body>
<img src= "../img/logo.png" alt= "Site logo">
<ul>
<li><a href="">Home</a></li>
<li><a href="">Portfolio</a></li>
</ul>
<h1 id="portfolio">My Portfolio</h1>
</body>
</html>
1 Answer
Corey Cramer
9,453 PointsWhat you have in the code example above and what you tried is a relative path. So it's directions to get to the logo.png file based on where index.html itself is. ../ Go to index.html's parent directory img/ Go into the img directory logo.png Select the logo.png file
This would work if your website was set up as such (./ references the current directory where ../ references the parent directory):
./ (base url such as www.teamtreehouse.com)
./portfolio/index.html (www.teamtreehouse.com/portfolio/index.html)
./img/logo.png (www.teamtreehouse.com/img/logo.png)
But keep in mind when you're using relative paths that you are giving instruction based on where the file you're currently working on is in. The other alternative is an absolute path which is always based on the root directory.
Another thing to keep in mind when you're adding images to your file is you're looking for images specifically, what you had originally written is trying to find an index markup file and include it as an image.