Skip to main content
Rosieway
Aug 29, 2023 11:13 PM UTC
Solved

How to fix the 1/2 pixel off on "line object" component on Figma?

Hi there, I just discovered that the “line object” on Figma is always 1/2 pixel off. No matter how you adjust the stroke to be in the center, inside or outside.

Is there a way to make it become a full pixel? I want to create a line object and make it into component. However, the outline of the component will never wrap the line object to its edge but always 1/2 pixel inlined.

Here is what it looks like:

Thank you!

This topic has been closed for replies.
tank666
tank666Solution
Sep 1, 2023 7:15 AM UTC

This is a GIF from the “Explore auto layout properties” article in the Help Center.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

15 replies

Rosieway
RosiewayAuthor
Sep 6, 2023 4:56 PM UTC

Thanks for the link @Bryce_Driesenga ! The quality is really amazing!!

Oliver_Schwaiger
New Participant
Nov 22, 2023 8:54 PM UTC

I am curious @tank666, is this also something that is possible in CSS? Or what is the equivalent in code to achieve this – if you happen to know that.

tank666
Nov 22, 2023 9:17 PM UTC

Border in CSS are directed inside the container. That is, the border property in the CSS = include a stroke in the layout in the Figma auto layout properties.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Oliver_Schwaiger
New Participant
Nov 27, 2023 12:58 PM UTC

Ok yeah I thought so, but I do not understand why this is different in Figma?

Rosieway
RosiewayAuthor
Nov 27, 2023 9:57 PM UTC

Thanks for responding to the CSS related question. From what you said, it seems like Figma can reflect what we do on CSS level right?
If so, I got another question (not sure if it’s related), if today we’re going to create a square card that has the radius at 5px with both width and height in 100px. We can create that on CSS right away! But that’s say, if we wanted to enlarge the square into 200px by 200px on CSS, this square’s radius should still remain 5px right? Unless we change the value on the radius.

I ran into another situation that I shared on this post: Resizing an auto-layout and constraints set up elements without stretching on corner radius?

I wonder if it’s the same logic? Thank you very much!!