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.

Piper Nilsson
858 Pointswhen I applied a transform "scale" to my logo it scaled outside the viewbox (so it looked cropped)
Hello, I tried applying a rotation and scale to a logo element. Here's my code:
leaf {
transition: transform .3s ease-out;
transform-origin: 50% 50%;
}
logo:hover #leaf {
transform: rotate(10deg) scale(1.2);
}
It worked, but when the leaf scales it grows out of the viewbox so it looks cropped. I applied some padding to the svg which seemed to fix it, but I don't really want that extra padding around the logo. Is there a better way to do it?
svg#logo { max-width: 600px; margin: 20px; padding: 5%; }
1 Answer

Bryan Land
10,269 PointsUse the relative positions of the logo's container element by specifying:
leaf {
transition: transform .3s ease-out;
transform-origin: 50% 50%;
transform-box: fill-box; /* fix for chrome */
}