Home > Mobile >  HTML image not being displayed on Chrome, or Safari web browsers and is returning 404 error when I i
HTML image not being displayed on Chrome, or Safari web browsers and is returning 404 error when I i

Time:01-13

For some reason when I try to insert an image in my website it is not being displayed in Chrome, or Safari web browsers. When I inspect the page, it is showing that there is a 404 error for the image I am trying to display which is the "software" image. I have a sample code below. The service image is displayed fine, but the software image is showing an error that reads "Sorry, this page doesn't exist. Please check the URL or go back a page. 404 Error. Page Not Found" when I inspect the page.

<!doctype html>

`

</head>
<body>
    <img id="software" src="images/software (1).png" alt="">
    <img id="service-image" src="images/service.jpeg">
</body>
`

CodePudding user response:

This is just a guess, so far, without (of course) having seen your code.

But, how are you referencing the images in your image tags?

Are you using a relative path (relative to the root of your website), or are you spelling all of it out using the file's file system location? So that the URL looks something like "C:\hibbert\TDAT\images\image001.jpg"?

If you do the latter, you will get the results you're describing, because the HTML will be telling the browser "Look for this file in the file system of the computer you're running on", and the only computer that has that file is the server.

CodePudding user response:

Did you try placing an alt text as if the site couldn’t display the image it will show the text of what is supposed to be there that way you will know if the file path is wrong

Also what is your text editor as vsCode can help you write your file path to make sure it is correct

Insert something like this into the image tag and see if that works

alt=“image goes here”

  •  Tags:  
  • Related