Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 3 min read

Why Figma HTML Exports (Anima, Locofy) Break When Translated into German or Arabic

Your Anima or Locofy export looks correct in English, then a German heading wraps and collides with the description underneath. In Arabic, the same card can keep its content pinned to the left instead of following the te

Your Anima or Locofy export looks correct in English, then a German heading wraps and collides with the description underneath. In Arabic, the same card can keep its content pinned to the left instead of following the text direction. The usual culprit is a pair of export assumptions baked into CSS: fixed pixel widths and absolutely positioned text.

Problem

Figma records where layers appear on the canvas; it does not guarantee that exported text will stay the same size or occupy the same number of lines after translation. A rule such as width: 320px can be too narrow for a longer German phrase, while position: absolute prevents the heading from reserving space for the description below it.

.card {
  position: relative;
  width: 320px;
}

.card-title {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 288px;
}

.card-copy {
  position: absolute;
  top: 56px;
  left: 16px;
  width: 288px;
}

Both text elements are positioned relative to the card, so the description stays at top: 56px even when the heading grows to two or three lines. Increasing that offset may hide one collision at one viewport, but it does not make the layout responsive to copy length.

The same offsets cause a separate problem in Arabic. left and right describe physical screen edges, not the start and end of the current writing direction. A rule anchored with left: 16px stays on the left in RTL. Manually swapping every left and right value is brittle: it can miss nested components, and it does nothing about the fixed width or the overlap.

Before changing the export, inspect the actual elements that collide. Check whether the text or its wrapper is absolutely positioned, and whether the next element is also out of flow. Temporarily setting the suspect text to position: static is a useful test: if the description moves down when the heading wraps, you have found a dependency on fixed positioning. The Anima and Locofy positioning walkthrough covers how to trace that relationship in an export.

Fix

Put text that must push other content down back into normal flow. Use a column flex container for the heading and description, and let the card’s inline size adapt to its parent. The logical sizing properties below work with the text direction rather than assuming that β€œwidth” and β€œleft” always mean the same physical edges.

.card {
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.card-title,
.card-copy {
  position: static;
  inline-size: auto;
  max-inline-size: 100%;
  margin: 0;
  text-align: start;
}

Apply the flex layout to the element that actually contains both pieces of text. If the export wraps them in another positioned element, changing only the heading’s positioning will not restore the relationship between the heading and description. Likewise, if cards themselves are absolutely positioned inside a list, one card still cannot push the next card down; make the list a flow container too.

For a card with an icon beside the text, keep the card’s children in a row and allow the text column to shrink. Set the direction on the component from the document’s language or an appropriate dir attribute. Use logical insets for any remaining intentional positioning:

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-row__text {
  min-inline-size: 0;
}

.card-badge {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
}

min-inline-size: 0 matters in flex layouts: without it, a text child can resist shrinking and overflow its card. inset-inline-end places the badge at the logical end, which changes sides in RTL. Avoid adding row-reverse just because the text is Arabic; combined with RTL direction, it can reverse the order twice.

Keep absolute positioning for deliberate overlays, not for text that must determine where the next element begins.

Test the patched component with a long German heading and an Arabic version at the same narrow viewport where the collision appeared. Confirm that the description moves when the heading wraps, that the card stays within its parent, and that icons and badges sit on the intended logical side. The related HTML translation layout notes are useful when checking the rest of a translated page, but this fix is specifically about restoring flow and direction-aware positioning in the exported component.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.