<?xml version="1.0" encoding="utf-8"?>

Images in another folder

Images in another folder

As we already mentioned, the src attribute identifies the image location. When dealing with assets like images, developers often prefer including them in a folder containing their HTML document. If it's on your computer in a sub-folder, you should mention the folder name using a forward slash in the src attribute. The syntax may look like this: <img src="/folder name/filename.jpeg">.

The same logic applies if you use images from your own website. Usually, the best option is to use relative URLs in the src attribute rather than absolute URLs. It prevents the URLs from breaking if you change a domain.

Top contributors

Lucas Pacheco Drozdowski

Topics

From Lesson

Share

Improve your UX & Product skills with interactive courses that actually work