move an image over another image

Asked

Viewed 52 times

0

I’m having some problems in css I think I have an image that when passing the cursor changes to a text, but I’m not getting over another image. have tried position:absolute but only gave me mistake.

Code:

.bgs5 {
  height: 600px;
  width: 400px;
  background-image: url(domicilio.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  /* texto  fica á em  cima da imagem  branca*/
  align-items: center;
  /* move para o centro  da outra imagem */
  flex-direction: column;
  /* faz uma coluna para o titulo ficar em  cima */
  position: relative;
  /* posicão  da imagem  branca */
  margin-left: auto;
  margin-right: auto;
  left: 21%;
}

.container {
  position: relative;
  width: 40%;
}

.image {
  position: relative;
  right: 30%;
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid black;
  margin-top: 40%;
}

.overlay {
  z-index: 9999;
  position: absolute;
  top: 38%;
  bottom: 0;
  left: -30%;
  height: 61%;
  width: 100%;
  opacity: 0;
  transition: 1s ease;
  background-color: #008CBA;
  border: 2px solid Black
}

.container:hover .overlay {
  opacity: 1;
}

.text {
  color: white;
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  text-align: center;
}
<div class="bgs5">

  <div class="container">
    <img src="entrada.jpg" alt="Avatar" class="image">
    <div class="overlay">
      <div class="text">Entradas</div>
    </div>
  </div>

  <div class="imagem">
    <img src="branco.jpg" width="100%" height="100%" alt="">
  </div>

</div>

Well I have a black background then I put a white image and on top of that white image I want to put my image in that when I put the cursor of me the inputs.

  • have you tried with css? Add the z-index attribute: -1

  • 1

    Lucas your question is a little confused, you could try explaining it better. Are you wanting to repeat the effect that already has on a black image on the white image too? Could not understand right what you need...

  • That’s how I get a picture of white. After this white image I want to put 6 more food images on top of this white image to give another effect. But when I move the white image I move the other image I want to be on top of it, do I understand? That is I can’t position the image with the food on top without spoiling it.

No answers

Browser other questions tagged

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