Image Tag is used for display a image in a webpage. If you want to display a image in a your html document then you should use <IMG> tag. In <IMG> tag, we provide a url of image which want to display. <IMG> tag is a empty tag. Image tag has many attributes to provide an awesome look of a picture. The important attribute of image tag is SRC attribute. Because it is used to provide url of the image.
- SRC: SRC attribute is used to provide a unique url of image. This is very important attribute for image tag. If you don’t use this attribute then you can’t display a image.
- ALT: This is a attribute of image tag. This attribute is used to display some alternative text at image. This is a important attribute for SEO. If our image can’t display due to any cause then ALT tag is display some text in the place of image.
- WIDTH & HEIGHT: Both are also a important attributes for a image. They are used to adjust width & height of a image. If you want to adjust image size then this attribute will be used. You need to provide some value for width & height. The value will be given in pixel or percentage.
- ALIGN: This attribute is also an important attribute for a image. This attribute is used to set alignment for a image. You can align a image at top, bottom, middle, left and right.
- BORDER: This attribute makes more attractive display for a image. This attribute provides border for a image. You can set border size in pixels.
The source code & output for image tag is given below:
<IMG SRC=”image/image.png” ALT=” THIS IS SKILLMAKING.COM” WIDTH=700 HEIGHT=500 ALIGN=RIGHT BORDER=20PX/>
OUTPUT OF IMAGE TAG: