Images allow for the display of graphics on a web page. Images are declared with the <img> tag which, unlike many other HTML elements, does not need a closing tag. The "src" attribute is used to specify the path and file name of the image. The "alt" attribute is used to describe the image with text. This will display if the image does not load and it is also used by screen readers to describe the image. The "height" and "width" attributes are used to set the size of the image.
The following image format extensions are permitted in most browsers:
If you would like to download our beautiful image sample, it is provided here:Download - people.png
<img src="people.png" alt="Two stick figures holding hands" height="250" width="400">
Image Link Syntax:
<a href="https://www.freecode.net/snippets_html_css/starter_html_template.php"> <img src="people.png" alt="Two stick figures holding hands" style="height: 250px; width: 400px;"> </a>
Runnable Image Example Code:
<!DOCTYPE html> <html> <head> <title>Audio Example</title> </head> <body> <img src="people.png" alt="Two stick figures holding hands" height="250" width="400"> </body> </html>
How to Run This Code:
Simply paste this code into a plain text file with the ".html" extension and save it. You will then be able to open it in the web browser of your choice. Make sure to download our sample image file and have it in the same folder as the HTML file.