HTML Image Tag
By Saket Bhatnagar••Beginner to Intermediate
image tag
- 1<img> tag is used to attach or embed images to our webpage.
- 2It is non-container tag.
- 3It is inline level element.
Attributes of image tag
- 1src attribute - It is used to provide path or location of the image.(Syntax:- src='path')
- 2alt attribute -It is used to provide alternative content or text to the image and this alternative content will be displayed only when the image is not displayed due to any reason and we should write meaningful content within alt attribute.(Syntax:- alt='text')
- 3height attribute - It is used to set height of the image.(Syntax:- height='value')
- 4width attribute - It is used to set width of the image.(Syntax:- width='value')
Example
- 1<img src = 'path' alt='text' height='300px' width='500px'>
- 2Note:- Path should be relative(The path with respect to current directory is called as relative path)