Home › HTML Tutorial › HTML images
HTML images
Show pictures with img.
Use src, alt, width and height. Wrap in a to make a clickable image, and picture to offer several sources.
Commands in this lesson
alt
Definition: Text description of an image, shown if it fails to load and read by screen readers.
Syntax:
<img src="file" alt="text">
Example:
<img src="x.png" alt="A sleeping cat">a
Definition: Creates a hyperlink to another page or resource.
Syntax:
<a href="URL">link text</a>
Example:
<a href="https://example.com">Visit</a>Example code
<img alt='Green square' width='100' height='100' src='data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27100%27 height=%27100%27%3E%3Crect width=%27100%27 height=%27100%27 fill=%27%231b998b%27/%3E%3C/svg%3E'>'