Repository navigation
Expand file tree
/
Copy pathindex.md
More file actions
145 lines (120 loc) · 3.56 KB
/
Copy pathindex.md
File metadata and controls
145 lines (120 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
title: "`<bdo>` HTML bidirectional text override element"
short-title: <bdo>
slug: Web/HTML/Reference/Elements/bdo
page-type: html-element
browser-compat: html.elements.bdo
sidebar: htmlsidebar
---
The **`<bdo>`** [HTML](/en-US/docs/Web/HTML) element overrides the current directionality of text, so that the text within is rendered in a different direction.
{{InteractiveExample("HTML Demo: <bdo>", "tabbed-standard")}}
```html interactive-example
<h1>Famous seaside songs</h1>
<p>The English song "Oh I do like to be beside the seaside"</p>
<p>
Looks like this in Hebrew:
<span dir="rtl">אה, אני אוהב להיות ליד חוף הים</span>
</p>
<p>
In the computer's memory, this is stored as
<bdo dir="ltr">אה, אני אוהב להיות ליד חוף הים</bdo>
</p>
```
```css interactive-example
html {
font-family: sans-serif;
}
bdo {
/* Add your styles here */
}
```
## Attributes
This element's attributes include the [global attributes](/en-US/docs/Web/HTML/Reference/Global_attributes).
- `dir`
- : The direction in which text should be rendered in this element's contents. Possible values are:
- `ltr`: Indicates that the text should go in a left-to-right direction.
- `rtl`: Indicates that the text should go in a right-to-left direction.
## Usage notes
The text's characters are drawn from the starting point in the given direction; the individual characters' orientation is not affected (so characters don't get drawn backward, for example).
## Examples
```html
<!-- Switch text direction -->
<p>This text will go left to right.</p>
<p><bdo dir="rtl">This text will go right to left.</bdo></p>
```
### Result
{{EmbedLiveSample('Examples')}}
## Technical summary
<table class="properties">
<tbody>
<tr>
<th scope="row">
<a href="/en-US/docs/Web/HTML/Guides/Content_categories"
>Content categories</a
>
</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content"
>Flow content</a
>,
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content"
>phrasing content</a
>, palpable content.
</td>
</tr>
<tr>
<th scope="row">Permitted content</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content"
>Phrasing content</a
>.
</td>
</tr>
<tr>
<th scope="row">Tag omission</th>
<td>None, both the starting and ending tag are mandatory.</td>
</tr>
<tr>
<th scope="row">Permitted parents</th>
<td>
Any element that accepts
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content"
>phrasing content</a
>.
</td>
</tr>
<tr>
<th scope="row">Implicit ARIA role</th>
<td>
<code
><a href="/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/generic_role"
>generic</a
></code
>
</td>
</tr>
<tr>
<th scope="row">Permitted ARIA roles</th>
<td>Any</td>
</tr>
<tr>
<th scope="row">DOM interface</th>
<td>
{{domxref("HTMLElement")}} Up to Gecko 1.9.2 (Firefox 4)
inclusive, Firefox implements the
<code
><a href="/en-US/docs/Web/API/HTMLSpanElement"
>HTMLSpanElement</a
></code
>
interface for this element.
</td>
</tr>
</tbody>
</table>
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- Related HTML element: {{HTMLElement("bdi")}}