2

css の方向に問題がありました。修正した後、修正が機能する理由を理解しようとしています。これが問題でした。

css を取得しました , html{direction:rtl;}ltr から数値を提示したかったので, span タグを使用してこの span タグのスタイルを cssで設定span{direction:ltr;}することにしました , しかし、なぜうまくいかなかったのかわかりません , 試してみました ,両方でspan{text-align:left;}使用,方向とtext-align、最後に2つの解決策を見つけました:!important

  1. 1 つ目は、属性 dir='ltr' を使用することです。
  2. 2 つ目は、span{direction:ltr;display:inline-block} です。

私は 2 番目の解決策を使用していますが、両方を説明できる人がいれば、とても感謝しています。

4

1 に答える 1

3

After digging into w3c specs I think I found an answer to your problem

From w3c:

HTML or XHTML served as text/html

Use markup only. The CSS2 recommendation recommends the use of markup for bidi text in HTML. In fact it goes as far as to say that conforming HTML user agents may ignore CSS bidi properties. This is because the HTML specification clearly defines the expected behaviour of user agents with respect to the bidi markup.

Emphasis added

So I am guessing that when you had direction: rtl; set in your css, it was completely ignored by the browser.

The spec clearly says that you should use the dir attribute in your markup for rtl layouts.

Although you have the CSS working for the browsers you have checked, it is not a solution for all browsers. Read the CSS spec for bidi/direction here

于 2013-07-26T18:48:03.350 に答える