Lesson: HTML5 and CSS
Add Images to your Website
You can add images to your website by using the
img element, and point to a specific image's URL using the
An example of this would be:
img elements must have an
alt attribute. The text inside an
alt attribute is used for screen readers to improve accessibility and is displayed if the image fails to load.
Let's add an
alt attribute to our
img example above:
<img src="https://www.your-image-source.com/your-image.jpg" alt="Author standing on a beach with two thumbs up. ">
Note that in most cases,
img elements are self-closing.
Try it with this image: