How to put background image?

Asked

Viewed 557 times

2

How do I put a picture in the background of my website? It’s not working.

HTML

<!DOCTYPE html>
<html>
    <head>
        <title> Praticando #1 </title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="estilos.css" />
    </head>
    <body>
         <div class="fundo1"> Café.com </div>
    </body>
</html>

CASCADE STYLE

body{
    background-image: url ("///F:/projeto/bistro.png");
    background-repeat: no-repeat;
}
  • The "project" folder is where your html file is?

  • Yes, the folder is inside my USB stick, with the html file, css and image

  • Have you tried just bistro.png?

  • Already tried, saved as jpg... It is always the div up there without the background image

  • try to put in place of body, html

1 answer

1


Your CSS has a syntax error:

               espaço errado
                     ↓
background-image: url ("///F:/projeto/bistro.png");

The term url should be next to the parentheses:

background-image: url("///F:/projeto/bistro.png");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.