HTML Inserting Images (<img>)
HTML utilizes the <img> tag to show images on webpages. The <img> tag doesn't require a closing tag because it functions as an empty element.

Syntax
<img src="image.jpg" alt="Description of image">
Attributes
| Attribute | Description |
|---|---|
| src | Path or URL of the image |
| alt | Alternate text shown if image cannot load |
Example: Displaying a Local Image
- width and height: set dimensions in pixels (optional)
- Best practice: use alt text for accessibility and SEO
<img src="logo.png" alt="Company Logo" width="200" height="100">
Example : Displaying an Image from a URL
The image is loaded from an external website.
<img src="https://example.com/photo.jpg" alt="Landscape Photo">
Example: Image Inside a Link
Makes the image clickable like a button.
<a href="https://example.com"> <img src="button.png" alt="Click Here"> </a>
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com