CSS for RTL Languages

When your Language setting in Salesforce is set to a right-to-left (RTL) language, the framework automatically flips property names, such as left and border-left to right and border-right respectively. The framework also rearranges certain values like padding, margin, and border-radius so that the right and left units are swapped.

These properties are automatically flipped for RTL languages.

PropertyFlipped Property
leftright
rightleft
border-leftborder-right
border-left-colorborder-right-color
border-left-styleborder-right-style
border-left-widthborder-right-width
border-rightborder-left
border-right-colorborder-left-color
border-right-styleborder-left-style
border-right-widthborder-left-width
border-top-left-radiusborder-top-right-radius
border-top-right-radiusborder-top-left-radius
border-bottom-left-radiusborder-bottom-right-radius
border-bottom-right-radiusborder-bottom-left-radius
padding-leftpadding-right
padding-rightpadding-left
margin-leftmargin-right
margin-rightmargin-left
nav-leftnav-right
nav-rightnav-left

These keywords are automatically flipped for RTL languages.

KeywordFlipped Keyword
ltrrtl
rtlltr
leftright
rightleft
e-resizew-resize
w-resizee-resize
ne-resizenw-resize
nw-resizene-resize
nesw-resizenwse-resize
nwse-resizenesw-resize
se-resizesw-resize
sw-resizese-resize

If the value is a percentage for these properties, the flipped value is set to 100 minus the value.

  • background
  • background-position
  • background-position-x

For these properties that can take four values, the second and fourth values are swapped. For example, property: A B C D becomes property: A D C B.

  • padding
  • margin
  • border-color
  • border-style
  • border-width

The arguments for the border-radius property are flipped with these patterns.

ArgumentsFlipped Arguments
border-radius: A Bborder-radius: B A
border-radius: A B Cborder-radius: B A C
border-radius: A B C Dborder-radius: B A D C

To override the automatic flipping, add a /*@noflip*/ annotation in a comment directly before the property. For example:

Use the @if(isRTL) conditional statement to manually provide the appropriately oriented CSS for each direction.

See Also