Why do I need to enter the full address? <img src...>

Asked

Viewed 99 times

-2

I’m trying to make my first website.

At the moment I do not understand why, when inserting images I have to insert the full address, since in all blogs and HTML sites, this is not necessary. The image is in another folder. Someone help me?

The following works:

<img src="/home/rafa/Desktop/Curriculum Vitae/imagens/hall.jpg" alt="Foto inicial">

This one no longer:

<img src="/imagens/hall.jpg" alt="Foto inicial"> 
  • 1

    But where on the page are you looking at the images? On the page Curriculum Vitae?

  • Have you hosted your site on any server? Or are you just opening pure HTML via file, with no http server?

  • Yes yes. I’m not using any server, I’m just experimenting with pure HTML.

1 answer

0


If your HTML page is at the same level as the images folder, in this case inside the Curriculum Vitae folder, you will be able to access the image by src=imagens/hall.jpg or making src=./imagens/hall.jpg. The way you did, the browser is looking for the images folder in the directory /.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.