Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Web Browser
Adding Images

Image vs Div Background

You've learned how to add images to a web page using the <img> element and the background property. What's the difference between these two methods? When should one method be used over another?

The method used depends on the type of image.

Some images are part of the content of a web page (icons, logos, album photos, etc.) and they communicate important information to a user. Other images are intended simply to style a web page (header backgrounds, etc.), not to communicate important information.

When an image communicates important information, you can use the <img> element and style the image using CSS, if needed.

When an image is intended to style a web page, you can use the background property and further style it with CSS.


Take a look at the web page to the right. What differences do you notice between the images used on the web page?

Report a Bug
If you see a bug or any other issue with this page, please report it here.