How to properly rotate a web element to match an angled design from Figma?

I’m working on a web project and I have a Figma design where one of the elements is rotated at 4.93 degrees. When I try to recreate this rotation using CSS transform property with the same angle value, the result doesn’t look like what I see in the Figma layout. The rotation seems off somehow.

Here’s my current code:

HTML:

<div class="banner">
    <img src="assets/ribbon.svg" alt="rotated_banner" class="banner__image">
</div>

CSS:

.banner__image {
    transform: rotate(-4.93deg);
}

What could be causing this difference between the Figma design and my CSS implementation? Are there any additional properties or techniques I should use to achieve the exact same visual result as shown in the design file?

This happens all the time when moving designs from Figma to CSS. Figma and browsers use different coordinate systems - they don’t calculate rotations from the same reference point. Add transform-origin: center center; so your element rotates around its actual center. Also check if you’ve got positioning or display properties messing with the transform. Floated elements and flexbox containers love to break rotations. Try wrapping your image in a container div and rotating that instead - works way better for complex layouts.

check your svg dimensions against whats in figma - i’ve seen exports not match the artboard size. add will-change: transform to smooth out the rotation rendering. browsers get weird with sub-pixel rotations, so try nudging it 0.1-0.2 degrees manually.

This is probably a Figma vs browser rendering issue. I’ve hit this exact problem before - browsers round decimal rotation values differently than design tools. Try transform: rotate(-4.93deg) with backface-visibility: hidden and perspective: 1000px on the parent element. These force hardware acceleration and improve rotation precision. Also check if your image has default margins or if the parent container dimensions don’t match what’s in Figma. Sometimes rotation looks wrong because the element’s bounding box is different from the design file.

also, make sure you’re not having any other styles affecting the rotation. check margins or paddings as they might shift the position. using transform-origin like you said can help a lot to fine-tune it!

Check if your SVG is getting clipped after rotation. When elements rotate, their bounding box changes and parts can get hidden by parent containers with overflow settings. Had this exact problem last month - rotation angle was fine but the container wasn’t accounting for the new dimensions. Add some padding to the parent or temporarily set overflow: visible to see if that’s it. Also check for anti-aliasing differences between your browser and Figma’s rendering - might affect how the rotated edges look.