Wielojęzyczność

i18n/logical-properties

In projects with a right-to-left locale, layout uses logical properties (margin-inline-start, inset-inline-end, text-align start).

umiarkowanaręcznefe-i18n

Dlaczego

margin-left, padding-right, left: 0 and text-align: left stay on the same physical side when the page switches to dir="rtl", so icons sit on the wrong side of labels and menus open off-screen. Overrides for every rule under [dir="rtl"] double the CSS and drift out of sync.

Poprawka

Use the logical forms: margin-inline-start, padding-inline-end, inset-inline-start, border-start-start-radius, text-align: start. Flip directional icons (arrows, chevrons) with :dir(rtl) .icon-arrow { transform: scaleX(-1); }, but not logos, media controls or checkmarks. In a project with only left-to-right locales this is a good habit, not a defect (lane A's css/logical-properties covers it there).

Przykłady

/* bad */
.badge { margin-left: 0.5rem; text-align: left; }
/* good */
.badge { margin-inline-start: 0.5rem; text-align: start; }

Źródła

Fakty

Identyfikator
i18n/logical-properties
Waga
umiarkowana
Sprawdzanie
ręczne ocenia człowiek; raport podaje to jako listę kontrolną
Dotyczy plików
css scss less
Uczy jej skill
fe-i18n Internationalisation
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain i18n/logical-properties