Hover over div and open larger

Asked

Viewed 492 times

1

I wish that when passing the mouse over a div, that same div be enlarged, as in the image below:

inserir a descrição da imagem aqui

I have a list with several elements, when pass the mouse over the element (div), she would stand on top right in the center and open an effect (perhaps css3 Transition).

Any hint?

  • 1

    Too wide ? Who said that ?

1 answer

7


So you refer to ?

div.content {
  position: relative;
  padding: 20px;
  width: 880px;
}
div.blocos {
  width: 200px;
  height: 200px;
  margin: 5px;
  float: left;
  border: 1px solid black;
  cursor: pointer;
  background-color: #C7C7C7;
  position: relative;
}

div.o{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  width: 150px;
  height: 150px;
  background-color: #F7F7F7;
  transition: all 0.4s ease-in;
}
div.blocos:nth-child(2n+2) {
  background-color: #000;
}
div.blocos:hover div.o{
  transform: scale(1.8);
  -webkit-transform: scale(1.5);
  -moz-transform: scale(1.5);
  -o-transform: scale(1.5);
  z-index: 2;
  background-color: rgba(0,0,0,0.7);
}
<div class="content">
  <div class="blocos">
  <div class="o"></div>
  </div>
  <div class="blocos">
<div class="o"></div>
  </div>
  <div class="blocos">
<div class="o"></div>
  </div>
  <div class="blocos">
<div class="o"></div>
  </div>
  <div class="blocos">
<div class="o"></div>
  </div>
</div>

  • Yes, however, it would open another div to that effect, it would not increase the same. I need other content inside this div that will open, and it would have to be on top of all the others.

  • 1

    I edited the post. See if it suits you

  • Thanks @Tobymosque... I had forgotten the effect.

  • @Zoom, added the prefix vendor -webkit- to the transform

  • @Zoom, AP didn’t ask for the effect, I just think it’s weird this kind of animation without ;D

  • I saw @Tobymosque, added two more and unified the transition in a single line

  • Yes, you did, here: would open with an effect, perhaps css3 Transition....

  • That’s right, I just added a Hidden visibility when the mouse is not on top, and added a Visible visibility when passing the mouse, I’ll test it!! Thank you very much!

  • @Lucashenriquedutra I think opacity: 0 and opacity: 1 is more professional than using visibility.

  • I will use, I had used visibility because I read in some forum that I could use some effect with Transition, but this is great. Thanks @Zoom !!

Show 5 more comments

Browser other questions tagged

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