Menu
Coddy logo textTech

Image Attributes

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

Let’s explore some additional attributes to improve your images:

  1. alt: Provides alternative text if the image doesn’t load .
  2. width and height: Control the size of the image in pixels.

Here’s an example:

<img src="img.jpg" alt="A scenic view of mountains" width="600" height="400" />

This sets the image source, provides a description, and sizes it to 600x400 pixels. Always include alt for accessibility and use dimensions to maintain design consistency. 

challenge icon

Challenge

Easy

Add the following attributes to the image:

  1. alt: "A beautiful bird"
  2. width: "400"
  3. height: "250"

Cheat sheet

Use additional attributes to improve your images:

  • alt: Provides alternative text if the image doesn't load
  • width and height: Control the size of the image in pixels
<img src="img.jpg" alt="A scenic view of mountains" width="600" height="400" />

Always include alt for accessibility and use dimensions to maintain design consistency.

Try it yourself

<!DOCTYPE html>
<html>
    <body>
         <img src="https://4.img-dpreview.com/files/p/E~TS590x0~articles/3925134721/0266554465.jpeg">
    </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