Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.