How to insert an image in HTML?

HTML Image syntax:-

  • In HTML images are defined by <img> tag.
  • It is an empty tag, it only contains attributes doesn’t have a closing tag.
  • In src attribute we put url(path/web address) of an image.

The syntax of insertion of an image given below:-

<!DOCTYPE html>

<html>
<body>

<h2>Web designing wallpaper</h2>
<img src=”wallpaper.jpg” alt=” best web designing wallpaper”>

</body>
</html>

  • In above example we give a heading for image.
  • In src attribute we give the path/url of image.
  • In alt attribute we give keyword for image to come first in search for this image on Google(SEO purpose).

NOTE: If our image is in another folder then we use “/” with folder name before image path like

Folder name=image;

<img src=”/image/wallpaper.jpg” alt=” best web designing wallpaper”>.

 

Leave a Reply

Your email address will not be published. Required fields are marked *