In my opinion, handling of the dir
attribute isn't especially well specified, which could explain why different browsers handle your situation differently. I'm guessing that since your <span>
element is empty, and since it is retaining its default display
property of inline
, it no defined dimensions on the page. Chrome is optimizing by simply not bothering to apply the rtl
formatting to it. When you change the display
property to inline-block
, you're giving the <span>
a height and width, albeit 0. Chrome is "smart" enough to optimize when the element has no height and width defined, but it doesn't go the extra step of optimizing when the element has a defined height and width of 0. That's just a guess, though.
FWIW, I've found the CSS direction
property to be more reliable than the dir
attribute.