Image
Last updated
Was this helpful?
Last updated
Was this helpful?
Attribute
Description
Embeds an image in the document
src
The value of the src attribute can be a path to a local image or an url to a remote image.
alt
An alternative to identify the content of the image for screen readers.
The <img element is our first element that demonstrates the use of attributes on the element.
<img src="images/pink-jelly.jpg" alt="jellyfish">
src - the location of the image file
can be the relative location of an image file within the project directory
can also be an URL to a remote image file.
alt - text used to support accessibility and search engines, or to display fallback text in case the image cannot be loaded.
This means that they only take up as much horizontal space as their width and it can effect how the content following it behaves. For more information on how this effects the display of an images see the topic on.
The best format for images are jpeg
, gif
, or png
.
Store images in a special folder, named images, within the project to keep things organized.
Save the image in the correct size for which it will be displayed so that it doesn't waste a lot of time downloading. If you need to crop or shrink an image, sites like are a good choice.
Just like we used place-holder text for our paragraph content, we often need place-holder images to use for development purposes. The sites and are great sites that have a wide assortment of free images to use in your pages.