0

I'm trying to learn html and I'm trying to add an image, I put the image in the same folder as my html file and named it spoder.png. When I tried to load it up in my browser, the image won't appear and only the alt message comes up. How do I fix this?

<!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="/spoder.png" alt="image cannot load">
</body>
</html>
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • 2
    Does this answer your question? [How to properly reference local resources in HTML?](https://stackoverflow.com/questions/14489016/how-to-properly-reference-local-resources-in-html) – esqew May 11 '20 at 18:56

2 Answers2

1

If it's in the same folder, the src atrribute must be src="spoder.png" (no slash)

Johannes
  • 64,305
  • 18
  • 73
  • 130
0

Agree with the previous answer and will just add that the leading slash always points back to the root.

Michael B
  • 31
  • 1
  • 3