How do you insert an image into HTML?
Use the <img> tag. It is an empty element, so it has no closing tag. Two attributes are needed: src (the path of the image) and alt (a short text description).
<img src="images/photo.jpg" alt="A boy playing cricket" width="300" height="200">
srccan be a relative path likeimages/photo.jpgor a full URL.altis shown when the image cannot load, and read by screen readers.widthandheightset the size in pixels.
See HTML Images.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |