Skip to content

Commit c3a3378

Browse files
committed
Text Direction
1 parent 2263e18 commit c3a3378

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,37 @@ The typical usage is when you render something on the server side. The usual use
20492049
<b><a href="#">↥ back to top</a></b>
20502050
</div>
20512051

2052-
#### Q. ***How do you change the direction of html text?***
2052+
## Q. ***How do you change the direction of html text?***
2053+
2054+
The default text direction in HTML is left-to-right. However, when developing web content and applications, we may need to set it to right-to-left, for instance, to cater for languages such as Arabic, Hebrew, Pashto, Persian, Urdu, and Sindhi.
2055+
2056+
We can set text direction in HTML in one of two ways:
2057+
2058+
* With the HTML **dir** attribute
2059+
* With the CSS **direction** property
2060+
2061+
**Example**
2062+
2063+
```html
2064+
<!-- Syntax -->
2065+
<element dir="ltr|rtl|auto">
2066+
2067+
<!-- Example -->
2068+
<textarea dir="rtl"></textarea>
2069+
```
2070+
2071+
**Attribute Values**
2072+
2073+
|Value |Description |
2074+
|---------------|---------------------------|
2075+
|ltr |Default. Left-to-right text direction|
2076+
|rtl |Right-to-left text direction|
2077+
|auto |Let the browser figure out the text direction, based on the content|
2078+
2079+
<div align="right">
2080+
<b><a href="#">↥ back to top</a></b>
2081+
</div>
2082+
20532083
#### Q. ***When is it appropriate to use the small element?***
20542084
#### Q. ***How do you serve a page with content in multiple languages?***
20552085
#### Q. ***What is the difference between `<section>` and `<div>`?***

0 commit comments

Comments
 (0)