Translate Figma Auto Layout padding, direction, and spacing to Flexbox

Tests your ability to bridge design tools and CSS layout mechanics. Match direction to flex-direction, padding to gap or container padding, space-between to justify-content, and hug/fill to flex-grow or flex-shrink.
What's really being asked
This question probes whether you can bridge the gap between design-tool semantics and browser layout mechanics. Figma Auto Layout uses concepts like direction, padding, spacing, and resizing modes that do not map directly to single CSS properties. A senior candidate should demonstrate fluency in both worlds and know how to build a robust component that survives dynamic content.
The full answer
First, map the Auto Layout direction property to flex-direction, using row or column depending on the design. Second, translate the spacing between items to the CSS gap property on the flex container, while mapping the container padding to padding on that same container. Third, convert distribution settings like space-between to justify-content values such as space-between or space-around. Fourth, address resizing behaviors: a hug-contents frame maps to the default flex-basis auto with no flex-grow, while a fill-container frame maps to flex-grow 1 and flex-shrink 1 with an appropriate flex-basis. Fifth, mention cross-axis alignment by mapping Auto Layout alignment to align-items, such as stretch or center. Sixth, discuss overflow handling, because Flexbox will not automatically wrap unless flex-wrap is set, and text truncation may require additional rules.
The mistakes people make
Candidates sometimes treat Auto Layout as a direct visual clone and use static margins or absolute positioning to mimic spacing. Another red flag is ignoring the difference between container padding and item spacing, which leads to brittle margin hacks. Some engineers also forget to account for hug versus fill, producing components that break when the viewport or text length changes. Using margin-left on every child except the first to simulate gap is an outdated anti-pattern.
What usually comes next
An interviewer might ask how you would handle nested Auto Layout frames, which translate to nested flex containers. They could also ask about responsive behavior, such as when to switch from row to column using media queries, or how to handle minimum and maximum width constraints that exist in Figma but need min-width and max-width in CSS. Another follow-up is how you would manage baseline alignment for text-heavy cards.
A concrete example
Imagine a card with a vertical Auto Layout of 16 pixels padding, 8 pixels gap between a title and a button, and a fill-container width. In CSS, you would set display flex, flex-direction column, gap 8px, padding 16px, and justify-content flex-start. The card itself would have width 100 percent and the content area would rely on natural block behavior, or you could set flex-grow 1 on a middle section if the card stretches inside a parent grid. If the button is set to hug its text in Figma, it needs no special flex properties; if it must fill the card width, you would add align-self stretch or width 100 percent depending on the desired behavior.
Interview question
You are translating a Figma Auto Layout frame that has 24px container padding and 12px spacing between items. Which CSS approach preserves the layout semantics in Flexbox?
- a.Set margin: 12px on each child and padding: 24px on the container
- b.Set justify-content: space-between and padding: 24px on the container
- c.Set padding: 24px and gap: 12px on the flex containerCorrect
- d.Set gap: 24px on the container and padding: 12px on each child
Why? this is the answer
Figma Auto Layout spacing maps to the CSS gap property on the flex container, while container padding maps to CSS padding on that same container. Using margin on children is an outdated anti-pattern that breaks when content changes, and space-between controls distribution, not fixed item spacing.
Just read this? Test yourself on what you have been reading.
Read the original → developer.mozilla.org
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on css — each one lists the topics its interview covers.
See open roles