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

Mark Richards
Mark Richards
6,795 Points

CSS transform rotate bug in Firefox?

I have some CSS applying a hover rotate transform on my social icons, which have a border radius applied. These work fine in Chrome, but in Firefox, when I hover, the animation is very odd, with flashes of the animation appearing at the bottom of the web page and zooming across the screen (difficult to explain).

If I remove the border radisu and the icons are square, then the rotation works fine. It seems only to be a problem when the border radius is applied.

--- Here is my HTML code:

<div class="social-icons">
<a href="https://twitter.com" target="_blank"><div class="twitter-hover social-slide"></div></a>
<a href="https://www.facebook.com" target="_blank"><div class="facebook-hover social-slide"></div></a> <a href="https://uk.linkedin.com" target="_blank"><div class="linkedin-hover social-slide"></div></a> </div>

--- Here is my CSS code:

.social-slide { height: 24px; width: 24px; margin: 5px; float: left; -webkit-transition: all ease 0.5s; -moz-transition: all ease 0.5s; -o-transition: all ease 0.5s; -ms-transition: all ease 0.5s; transition: all ease 0.5s; } .social-slide:hover { background-position: 0px -24px; transform:rotate(360deg); -webkit-transform:rotate(360deg); -moz-transform:rotate(360deg); }

.twitter-hover { border-radius: 50px; background-image: url('../img/twitter-hover.png'); background-size: 24px 48px; }

.facebook-hover { border-radius: 50px; background-image: url('../img/facebook-hover.png'); background-size: 24px 48px; }

.linkedin-hover { border-radius: 50px; background-image: url('../img/linkedin-hover.png'); background-size: 24px 48px; }

.social-icons { height: 24px; width: 102px; margin: 30px auto; }

Any ideas? Thanks.

Edit: Interestingly, if I add a border of 1px, this fixes the problem, but I don't want the border, even if transparent as it seems to hide some of the background image.

1 Answer

Mark Richards
Mark Richards
6,795 Points

I had to apply the following property to each of my social icons:

outline: 1px solid #fff;

Maybe there is a better way?