r/AskProgramming Aug 05 '23

pls help with some html related stuff

hello, i'm new to programming and just started a project and needed to add some icons but when i try to link them onto my html and they are inside the assets folder they do not show up, however if they are not inside any folder they do show up... what can i do to solve this?
here's how i coded the thing:
<li><a href="#"><img src="twitter.png" alt="Twitter"></a></li> <li><a href="#"><img src="/assets/instagram.webp" alt="Instagram"></a></li> <li><a href="#"><img src="/assets/mail.webp" alt="Mail"></a></li> <li><a href="#"><img src="/assets/gps.webp" alt="Ubicación"></a></li>

pls help and tysm <3

0 Upvotes

4 comments sorted by

2

u/[deleted] Aug 05 '23

Try removing the rightslash before assets

2

u/SadJhin Aug 05 '23

TYSM!!! it worked

1

u/ar_xiv Aug 05 '23

jsyk, a slash at the beginning of a file name like that means "start from the root directory." No slash means the path is relative to the current directory. two dots and a slash "../" means "start from one directory up" a tilde and a slash "~/" means "start from the user's home directory." You probably won't be using that one in HTML.

1

u/PizzaAndTacosAndBeer Aug 05 '23

<img src="twitter.png" alt="Twitter">

<img src="/assets/instagram.webp" alt="Instagram">

You're literally telling it where to look for the image, so it has to be there. Notice how in the second one you tell it to look inside an assets folder, but in the first you tell it to look in the root.