0

I have made a script using HTML code that involves images. These images work and display when using live server on VSC and I can also open the file when clicking and holding the COMMAND button - <img class="thumbnail" src="thumbnails/thumbnail-1.webp">

However when I copy and paste the code on another script, the image file cannot be found nor does the image display.

I cannot figure out why it doesn't work as it works perfectly on the first script but not others. The file directory for the images are the same and the script is also HTML type. All code is the exact same as the working script, but still doesn't work on new scripts

2
  • 1
    Can you please show us your file tree by expanding the necessary parts? Commented Apr 21, 2022 at 2:42
  • 1
    Please provide enough code so others can better understand or reproduce the problem.
    – Community Bot
    Commented Apr 21, 2022 at 3:57

2 Answers 2

1

Check again your folder name and file name Or try this <img src="/thumbnails/thumbnail-1.webp">

2
  • Adding the forward slash works, thank you. Commented Apr 21, 2022 at 3:17
  • Do you understand why the forward slash works? Commented Apr 21, 2022 at 8:00
0

You will have to use “alt=“ property under image tag . Your code will be like—-

<img class="thumbnail" src="thumbnails/thumbnail-1.webp" alt="html image">

Not the answer you're looking for? Browse other questions tagged or ask your own question.