Image in HTML

Hello World!, Welcome to my Blog.

In this blog, I am going to discuss about the image tag in HTML.

<img src="filename.jpeg" alt="alternative text" title="My image description" height="100px" width="100px" />
  • Img is self closing tag, we don't need to define the closing tags, but in img tag itself we add / before closing angular bracket, if you see in above example. The / is also optional as browser have idea about that, but to make it clean we add it.

  • src: src attribute is used to define the path of file, with its name, so that browser can render it from there.

  • alt: alt is used for alternative text in case image is not able to load, then it will show text mentioned in it.

  • title: It is used to show image information, when someone hover over the image.

  • height: It is used to define the height of image in pixels.

  • width: It is used to define the width of image in pixels.

This is all about image tag in HTML. If you like the blog, please leave a comment.

0
Subscribe to my newsletter

Read articles from Siddhant Srivastava directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Siddhant Srivastava
Siddhant Srivastava