To use an image on a webpage, use the <img> tag. The tag allows you to add image source, alt, width, height, etc. The src is to add the image URL. The alt is the alternate text attribute, which is text that is visible when the image fails to load.
With HTML, add the image source as the path of your system drive. For that, add the src attribute as a link to the path of system drive where the image is stored. For example, file:/D:/images/logo.png
The following are the attributes:
|Sr.No.||Attribute & Description|
The alternate text for the image
The height of the image
The image as a server-side image-map
The URL to a detailed description of an image
The URL of an image
The image as a client-side image-map
The width of the image
Just keep in mind the <img> tag has no end tag.
You can try the following code to set src to the img tag in HTML from the system drive.
Note: This will only work on your local system since the path is your local drive.
<!DOCTYPE html> <html> <head> <title> HTML img tag <title> </head> <body> <img src="file:/D:/images/logo.png" alt="Site Logo" width="50" height="50"> </body> </html>