dir =“rtl” vs text-align:right。它们之间有什么区别? [英] dir="rtl" vs. text-align: right. What is the difference between them?

查看:717
本文介绍了dir =“rtl” vs text-align:right。它们之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

html属性 dir 和css text-align 属性具有相同的结果。例如。考虑这两种情况:

The html attribute dir and the css text-align property acheive the same result. E.g. consider the two cases:


  1. dir =rtl

  1. dir="rtl"

<p dir="rtl">
		one two.
</p>


  1. text-align:right

  1. text-align: right

<p style="text-align: right;">
		one two.
</p>

两个结果是点的位置。为什么不< p dir =rtl>一二。 < / p> 已翻译为 .owt eno ?如果不能,那么 dir 属性的用途是什么?

The only difference between these two results is the placement of dot. Why isn't <p dir="rtl"> one two. </p> translated to .owt eno? If it can't then what is the use of dir attribute at all?

推荐答案

点的位置是dir和text-align之间的区别的关键点。处理从右到左脚本比处理文本的对齐更多的涉及。要更好地了解,请阅读

The placement of the dot is the crucial point of the difference between dir and text-align. Handling right to left scripts is much more involved than handling the alignment of the text. To understand better, read

https://www.w3.org/International/articles/inline-bidi-markup/uba-basics

一系列rtl字符如سلسلةنصيةالذهاب自动工作,因为Unicode双向算法依赖于字符的方向属性,但您需要更多的正确处理标点符号,图像和双向文本。

A sequence of rtl characters such as سلسلة نصية الذهاب works automatically because of the Unicode bidirectional algorithm relying on the character's directional properties, but you need more to properly handle punctuation, images, and bidirectional text.

bdi是元素,而不是属性名称。

bdi is an element, not an attribute name.

不要让bdi与bdo混淆。前者应用启发式来猜测文本的方向,后者覆盖双向算法(并且很少使用)。

don't get bdi confused with bdo. The former applies heuristics to guess the direction of text, the latter overrides the bidirectional algorithm (and is very rarely used).

有关如何使用的更完整的图片html中的RTL(或实际双向)文字,请参阅

For a more complete picture about how to work with RTL (or actually bidirectional) text in html, see

https://www.w3.org/International/tutorials/bidi-xhtml/index

这篇关于dir =“rtl” vs text-align:right。它们之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆