I need held with this code, I been trying to add a img in the body like a background i been see video and other problem like this but nothing work

<body>

    <header>

      <h1>Imagenes y Efectos</h1>

      <p>

        Diferentes imagenes de fondo, centrado,cuadricula y por supuesto efectos

        de transicion

      </p>

    </header>

    <div class="main"></div>

    <footer>

      <p>Sigue aprendiendo el maravilloso curso de HTML y CSS</p>

    </footer>

  </body>

HERE IS THE CSS

header,

footer {

  background-color: white;

  border-style: solid;

  border-radius: 20px;

  padding: 5px;

  text-align: center;

}

.main {

  height: 1200px;

}

body {

  background-image: url("carpeta1/foto0.jpg");

}

Assuming your directory structure is correct the one thing that will cause this to fail is the fancy quotes around carpeta1/foto0.jpg

You can remove them as they’re not needed but if you are going to use quotes you need to use quotes like this " "

Not sure exactly what you’re doing but you may want the body declaration first so you don’t overwrite the header, footer declaration.

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.