Home > Article > Web Front-end > HTML attribute dir that specifies the text direction of element content
Example
A paragraph with a direction from right to left:
<p dir="rtl">Write this text right-to-left!</p>
Browser support
All browsers support dir Attribute.
Definition and Usage
The dir attribute specifies the text direction of the element content.
Tips and Notes
Note: The dir attribute is not valid in the following tags: dde6fb694e6711ae5e6f381704c04ae4, 0c6dc11e160d3b678d68754cc175188a, 04a0d55efbbfd646a993fbc01f262c57, f900b4fc197b16ab214eecf015bb6bd2 , f32b48428a809b51f04d3228cdf461fa, d5ba1642137c3f32f4f4493ae923989c, 0c68fef83818661b6da588c77ca3985e and 3f1c4e4b6b16bbbd69b2ee476dc4f83a.
Syntax
<element dir="ltr|rtl">
Attribute value
Value | Description |
ltr | Default. Left to right text direction. |
rtl | Right-to-left text direction. |
Example
ltr left to right alignment
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="zh-CN">
rtl right to left alignment
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl" xml:lang="zh-CN">
The above is the detailed content of HTML attribute dir that specifies the text direction of element content. For more information, please follow other related articles on the PHP Chinese website!