Animation How to - Create Image sliding out effect








Question

We would like to know how to create Image sliding out effect.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.wrapper {<!--   www . jav a2 s.co  m-->
  position: relative;
  overflow: hidden;
  width: 197px;
  height: 162px;
}

#slide {
  position: absolute;
  left: -197px;
  width: 197px;
  height: 162px;
  transition: 0.5s;
  z-index: 200000;
}

.wrapper:hover #slide {
  transition: 0.3s;
  left: 0;
}
</style>
</head>
<body>
    <div style="margin-left: 19px; margin-top: -8px">
      <div class="wrapper">
        <a
          href=""
          target="_blank"> <img id="slide"
          src="http://www.java2s.com/style/download.png" />
        </a>
      </div>
    </div>

</body>
</html>

The code above is rendered as follows: