- Before add images to web page (HTML File)
- Add ur images to same folder where HTML file is created.(Suggest u to create different folder for images)
Code :
<img src="/folder_name/image.png">
we can add some attributes to make changes to image. like height
width
: <img src="/folder_name/image.png" height="100" width="60">
If somebody is visually impaired they may use screen reader to navigate a web page, it is good practise to add alt
text (Alternative Text) that read aloud by screen reader, as well as alt
is important to show message to user when image is damaged or image is missed.
<img src="/folder_name/image.png" height="100" width="60" alt="This is an image">
title
attribute can be used to add hover pop up text box
We can create image as a HyperLink so when we click on a image it redirects to the linked path. to do that
<a href="google.com">
<img src="/folder_name/image.png">
</a>