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

Scott Pierce
Scott Pierce
2,365 Points

Not sure why my images arent showing up.

My images only show up when my index.html is in the samr folder as my images. when trying to do it otherwise, it just shows the alt info.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <img src="images/portfolio-1.png" alt="gfhfghfg">

</body>
</html>
Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,671 Points

Question updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples.

2 Answers

Scott Pierce
Scott Pierce
2,365 Points

Turns out my images were in the wrong file on my computer. Thanks for your help though guys!

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

Hey. Image tag is a self-closing tag so it should have forward slash at the end.

<img src="images/portfolio-1.png" alt="gfhfghfg" />

This might be the solution to your problem.

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Self closing tags/empty elements can also be defined in the same way as the student's.

<meta charset="utf-8">
<img src="img/file.jpg" alt="picture">
<link rel="stylesheet" href="css/main.css">

<!--  Is the same as -->

<meta charset="utf-8" />
<img src="img/file.jpg" alt="picture" />
<link rel="stylesheet" href="css/main.css" />

Therefore it is a matter of preference and not the cause of the issue.