0
I’m learning how to create websites now and I’m having trouble inserting image by css. When I use the tag ;img src="image.jpg", in the file . html the image appears, but if I put it in the . css file and step to div, there is no sign of it.
I need help I don’t know what’s wrong
Here’s my html and css code:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RSU</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"/>
<link rel="stylesheet" href="css/estilo.css" type="text/css" />
</head>
<body>
<div class="top"></div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>
</html>
.top {
background-image: url('../imagens/caverna1920.jpg') no-repeat;
width: 500;
height: 500;
background-position: center;
}
Even adding % or px does not work, had previously put background-size: cover; and also did not work
– Magno
I edited my answer. I added another error I just checked.
– Valdeir Psr
That’s right, thank you and
– Magno