nickst97
nickst97

Reputation: 23

HTML: Can not display image file in subfolder of subfolder (tricky)

I am adding an image in my html file, but with that way

<img src="/img/logo/logo_500x150.png" class="logo" alt="Logo 500x150"/>

the webpage just show the "missing image" picture.

If I move the image to its parent subfolder, then everything works:

<img src="/img/logo_500x150.png" class="logo" alt="Logo 500x150"/>

Notes:

  1. the folder structure is:

    web/
        myfile.html
        img/
            logo/
    
  2. in both ways, when I am at the editor and ctrl+clicking the links, they are showing the image

How can I resolve this to show images properly?

Upvotes: 1

Views: 626

Answers (2)

FlorianR.
FlorianR.

Reputation: 66

if web is a public directory like www.somedomain.com/web

You can use

<img src="/web/img/logo/logo_500x150.png" class="logo" alt="Logo 500x150"/>

or

<img src="img/logo/logo_500x150.png" class="logo" alt="Logo 500x150"/>

Upvotes: 1

SavPhill
SavPhill

Reputation: 655

Image is located in the folder one level up from the current folder. Try img src=“../img/logo/

Upvotes: 0

Related Questions