Home >>HTML Tutorial >HTML Images
HTML provides you <img> tag to add images to your webpages. Only using texts in website, it made them appear quite boring and uninteresting. So, <img> tag is used to add images in webpages. It helps you to improve the designs and appearance of web pages.
<img> tag is also known as empty tag because there is no closing tags. It contains attributes only.
Attributes of HTML <img> tags are:
Let's take an example:
<!DOCTYPE html> <html> <head> <title>Inserting an image</title> </head> <body> <img src= "https://cdn140.picsart.com/315857494228201.jpg?type=webp&to=crop&r=256&q=70" alt="Img"> </body> </html>
Setting Height and width of the image: The attributes height and width value are specified in pixels by default.
Let's take an example of setting the height and width of the image:
<!DOCTYPE html> <html> <head> <title>Inserting an image</title> </head> <body> <img src= "https://cdn140.picsart.com/315857494228201.jpg?type=webp&to=crop&r=256&q=70" alt="Img" height="300" width="300"> </body> </html>
Adding animated Images: you can also add animated image in webpages. But it is necessary to use the extension of the image .gif.
Let's take an example of adding animated images:
<!DOCTYPE html> <html> <head> <title>Inserting an image</title> </head> <body> <img src="1.gif" alt="phptpoint.gif" height="300" width="300"> </body> </html>