最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

css - fit-content width breaks unicode-bid calculating - Stack Overflow

programmeradmin9浏览0评论

When using unicode-bidi: plaintext; the element renders in the correct direction, for example

<p>English ltr</p>
<p>عربي ltr</p>

*{
unicode-bidi: plaintext;
}

However, when also applying width: fit-content; the elements render as ltr only

demo

When using unicode-bidi: plaintext; the element renders in the correct direction, for example

<p>English ltr</p>
<p>عربي ltr</p>

*{
unicode-bidi: plaintext;
}

However, when also applying width: fit-content; the elements render as ltr only

demo

Share Improve this question edited Mar 31 at 23:25 Sherif eldeeb asked Mar 31 at 23:10 Sherif eldeebSherif eldeeb 2,2463 gold badges27 silver badges53 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The elements are rendered in the correct order from the right side of the div to the left. The div itself, however, is rendered from the left, so if it's size is fit-content it looks aligned left, but the order inside the div is the correct order.

Hover the Arabic text in the example to remove unicode-bidi, and see the difference.

p {
  width: fit-content;
  border: solid thin;
  
  &:not(:hover) {
    unicode-bidi: plaintext;
  }
}
<p>English</p>
<p>عربي ABCD</p>

发布评论

评论列表(0)

  1. 暂无评论