HTML IMAGES
Images are used to make web pages beautiful and more descriptive. More information can be presented through images and in a much easier way.
HTML displays images using <img> tag.
<img> tag is an empty tag. It does not have a closing tag.It has attributes only.
Syntax of <img> tag
Example
Syntax explanation:
- src - Used for giving url of image.
- alt - It provides additional information about the image.
Example
Output:

HTML img tag Attribute
<img> tag has other attributes too like width, height and border.These attributes let the user to define height,width and border of image.
-
width - It defines width of image.we can set width either in percentage,in pixels or in
other scales.
Example
-
height - It defines height of image.we can set height either in percentage,in pixels or in
other scales.
Example
-
border - We can also create border around the image using border attribute.
Example
A working example:
Example
Output:
