【发布时间】:2020-10-23 16:17:43
【问题描述】:
假设我遇到了如下问题。有没有办法只使用 CSS 来选择,只有 direction: rtl 样式的元素?提前致谢!
.rightToLeft {
direction: rtl;
}
.leftToRight {
direction: ltr;
}
/* Is there is any simple way to select all of the 3 different spans with the dirction=rtl property? */
<span class="rightToLeft">This is RtL, </span>
<span class="letfToRight">and this is LtR!</span> (: <br/>
<span dir="rtl">This is RtL too,</span>
<span style="direction: rtl;">and this one also! </span>
我已阅读this answer,但它仅在元素内部给出给定属性时才有效,而不是通过 CSS 类(前两个示例)。
【问题讨论】: