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 '); }