How To Create A CSS Image Float On Hover

With the release of CSS3 you can now use CSS to make animations on your html elements.

This shows an example of how you will get images to hover when the mouse hovers over them just by using CSS.

It uses the new feature of transition to change the margin property from 15px to 2px and will take 0.5 seconds to perform this action.

Below is the code you will need to do this. bounce

The HTML To Bounce Images

<img class="hoverImages" src="image.jpg" />
     <img class="hoverImages" src="image2.jpg" />
     <img class="hoverImages" src="image3.jpg" />

The CSS To Bounce Images

Now the CSS magic to perform the transition on the :hover event.

img.hoverImages {
	outline:2px solid #DDD;
	-webkit-transition: margin 0.5s ease-out;
    -moz-transition: margin 0.5s ease-out;
    -o-transition: margin 0.5s ease-out;
img.hoverImages:hover {
    margin-top: 5px;

Demo CSS Image Bounce

Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

Your email address will not be published. Required fields are marked *