Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Images, Text and Links Images and File Paths Challenge

andrew raymundo
andrew raymundo
2,953 Points

add in an image element withing the body

How do you add an image element within the folder named img ?

index.html
<!DOCTYPE html> 
<html>
  <head>
    <title>The Moon</title>
  </head>
  <body img="../../moon.jpg">
  </body>
</html>

You can do it using only css by add the background-imagem property example bellow.

body { background-image: url('img/someimage.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center; }

Nemanja Blagojevič
Nemanja Blagojevič
2,650 Points

You have used wrong tags.

Right way to do this is <body> <img src="../../someimg.jpg"> </body>

or just to select body in your CSS file and add rules body { background-image: url(' put here some URL '); }