Miguel Martin
Miguel Martin

Reputation: 37

Why won't my image load in html even tho I put the image in the same folder?

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>

Upvotes: 0

Views: 67

Answers (2)

Michael B
Michael B

Reputation: 31

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

Upvotes: 0

Johannes
Johannes

Reputation: 67758

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

Upvotes: 1

Related Questions