Menu
Coddy logo textTech

Images

Part of the Fundamentals section of Coddy's HTML journey — lesson 23 of 60.

Images can make your webpage more engaging, and adding them in HTML is simple using the <img> tag. The <img> tag is self-closing, meaning it doesn't need an ending tag.

To display an image, you need to use the src attribute. This attribute specifies the image's location (URL or file path). Here's an example:

<img src="https://coddy.tech/images/bit.svg" />

In this example, the browser will load and display the image from the URL https://coddy.tech/images/bit.svg.

Self-closing tags, like <img>, don't need a closing tag. They end with /> and are used for elements that don't have content inside.

challenge icon

Challenge

Easy

Add an image to HTML document, you can use the URL from the example in the lesson or any other URL.

Make sure you see an image!

Cheat sheet

The <img> tag displays images and is self-closing (no ending tag needed):

<img src="https://coddy.tech/images/bit.svg" />

The src attribute specifies the image location (URL or file path). Self-closing tags end with />.

Try it yourself

<!DOCTYPE html>
<html>
    <body>
        <!-- Write code here -->
    </body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals