Email or username:

Password:

Forgot your password?
Nikita

A question to my fellow #Web developers and designers: How do you handle checkboxes and labels with #RTL? It’s clear to me that their position should be flipped (see image by @shadeed9), but what are your preferred ways of achieving this (with static HTML)? Is `flex-direction: row` a valid approach, or are there other ways I’m missing?

3 comments
Michael

@kytta depends on how you implement it:
This particular one could just be an inline checkbox, which wouldn’t need any thinking about to put it to the right.

But otherwise flex-direction row together with semantic margins/paddings (padding/margin-inline-start/end) would usually do the trick for me.

@shadeed9

iliazeus

@kytta inputs and labels are both inline elements, so a browser already has rules for choosing between RTL and LTR. You can just use dir="auto" in HTML, and let the browser figure it out. Or set it explicitly with dir="ltr" and dir="rtl".

jsfiddle.net/04hn1cjw/7/

Nikita

@iliazeus you’re right! I’ve somehow never realized this and have never considered just using the elements without any CSS. Thanks a lot!

Go Up