To make a beautiful website images play an important role, as you can display complex things from a picture easily.
Inserting an image
To insert an image in HTML document <img> tag is used.
img tag does not have any closing tag. It has only attributes.
Attributes in img tag
1. src attribute
This attribute describe the path or source of an image. As in above example you can see the source is "images/demo1.jpg".
2. alt attribute
Sometimes images are unable to load so the text inside the alt attribute replaces the image.
3. width attribute
width attribute is used to define widtn for image.
4. height attribute
height attribute is used to define height for image.
If width and height attributes are not mentioned then image will be of its original size.
5. border attribute
border attribute is used to give a border to the image. More the value for border more wide border is made.