Background: url() will not

Asked

Viewed 34 times

-1

I want to add an image to my page, I’ve tried it in two ways, with background: url(img/girl.png); and background-image: url(img/girl.png);

The photo is on the right page, the photo is in the correct format, css is linked with html

<link rel="stylesheet" href="css/master.css" />

<title>Criativa</title>
<section class="header">

</section>


<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script
  src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
  integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
  crossorigin="anonymous"
></script>
<script
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
  integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
  crossorigin="anonymous"
></script>
<script
  src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
  integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
  crossorigin="anonymous"
></script>
.header {
width: 150px;;
background: url(img/menina.png);
background-image: url(img/menina.png);
background-position: center;
background-size: cover;
}

1 answer

0

I believe you need to put values in width and height want to allow the image to appear, as in the example I added try to remove the attribute height she goes away.

.header {
width: 150px;
height: 150px;
background-image: url(https://www.conversion.com.br/wp-content/uploads/2019/06/google-icone.png);
background-position: center;
background-size: cover;
}
<section class="header">

</section>

Browser other questions tagged

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