My file structure:
Documents—main_folder—-Folder_1 ——-page_1.html
| ——-Fiddlepic.jpg
|
—-Folder_2 ——-page_2.html
I’m new to html and coding, trying to understand file paths.
When my workspace in VS Code is Folder_1, I code this in page_1.html:
<img src="Fiddlepic.jpg"/>
and all goes well, photo shows in Preview.
So to test out my ‘path’ skills, I change workspace to Folder_2, and try this in page_2.html
<img src="../Folder_1/Fiddlepic.jpg"/>
and the photo doesn’t show up in Preview now.
I thought the .. would take me from Folder_2 back up to main_folder, and then /Folder_1/Fiddlepic.jpg would get me to the right place. VS Code was predicting this path as I typed as well…and I can control-click on the element and it takes me to the photo.
I have screen shots but I’m not sure if that’s the done thing on here.
Any ideas?
Thanks!
M Albeck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.