Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Milan Bogdanovic
Milan Bogdanovic
9,922 Points

CSS animations (translating icons up or down)

I have this html code:

     <div class="social-bar">
    <p id="msg">Moze i ovako:</p>
    <a href="https://www.facebook.com"><img src="dodaci/facebook.png" class="icons"></a>
    <a href="https://www.twitter.com"><img src="dodaci/twitter.png" class="icons"></a>
    <a href="https://www.foursquare.com"><img src="dodaci/foursquare.png" class="icons"></a>
    <a href="https://www.whatsapp.com"><img src="dodaci/whatsapp.png" class="icons"></a>
  </div>

and this Css code:

.social-bar{
  width: 480px;
  height: 84px;
  background-color: #1976D2;
  margin: 0 auto;
  margin-top: 25px;
  box-shadow: 0px 3px 6px 0px rgba(78, 124, 170, 0.75);
  border-radius: 10px;
}

.icons{
  width: 60px;
  margin-left: 45px;
  margin-top: -4px;
  transiton: all .4s ease-in-out;
}

.icons:hover{
transform:translateY(-20px)
}

How do i make them icons move up on hover. Thought, the translate property wolud be enough, but when i hover over them nothing happens they stand in place. Any help appreciated, Kind regards.

This is working fine the icons are moving -20px on y axis on hover.

Milan Bogdanovic
Milan Bogdanovic
9,922 Points

Oh well, i cleared my browser cache and it worked fine, don't know what happened. Maybe there is another way to do this. However, If you need something like this. Use it.