I need help with an error in my code... (HTML/CSS/JS)


so i’ve encountered an issue while coding in HTML, and i can’t make sense of the issue.

for the record, i’m fairly new to HTML, and i’m coding this for a class assignment.

codepen link:

screenshot of error


  <div class="container">
    <img id="background" src="https://physicsland.net/game1/Gameboard1.png" ; alt="background"></img>
    <img id="farmer" src="https://physicsland.net/game1/farmer1.png" ; alt="farmer"></img>
    <img id="hero" src="https://physicsland.net/game1/hero1.png" ; alt="hero"></img>
    <img id="door" src="https://physicsland.net/game1/door1.png" ; alt="door"></img>
    <img id="key" src="https://physicsland.net/game1/key1.png" ; alt="key"></img>
    <div id="forestdark"></div>
    <div id="text"></div>
  <div class="inventory">
    <img id="invCandle" src="https://physicsland.net/game1/candle.png" ; alt="candle"></img>
    <img id="invKey" src="https://physicsland.net/game1/key1.png" ; alt="key"></img>

  <p id="leftpixels">
  <p id="toppixels"></p>

An everyday gamer, minecraft 1.0 veteran, and PVZ master
Dillan Bowman / Bowmand117

Scratch - Bowmand117
Scratch - Bowmandalt
Scratch - Bowmand_test
Replit - DillanBowman
Github - Dillan bowman

The img tag only has one tag: <img src="some-url/some/path/image name.image extension" />. The slash (/) at the end is optional: <img attribute="value">. Also not sure why you have semicolons (;) between attributes…

1 Like

Matt nailed the error, img tag is self* closing in HTML. Welcome to HMTL and web dev, a good place to get familiar with is MDN (Mozilla Developer Network). It is a bit techy at 1st but, after a while it gets easier to read through the docs.

1 Like