Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/docs/text-align.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,61 @@ Use the `text-justify` utility to justify the text of an element:

</Figure>

### Text alignment with Directions (LTR and RTL)

Use the `text-start` utility to align text to the start of HTML element, regardless or the direction (LTR or RTL):

<Figure>

<Example padding={false}>
{
<div className="px-4 sm:px-0">
<div className="mx-auto max-w-lg p-8 text-sm/6 text-gray-900 dark:text-gray-200">
<p className="text-start">
EN text align start
</p>
<p className="text-start" dir="rtl" lang="ar">
نص عربي في بداية السطر
</p>
</div>
</div>
}
</Example>

```html
<!-- [!code classes:text-justify] -->
<p class="text-start">So I started to walk into the water...</p>
<p class="text-start" dir="rtl" lang="ar">هنا يبدأ النص...</p>
```

</Figure>

and use the `text-end` utility to align text to the end of HTML element, regardless or the direction (LTR or RTL),
<Figure>

<Example padding={false}>
{
<div className="px-4 sm:px-0">
<div className="mx-auto max-w-lg p-8 text-sm/6 text-gray-900 dark:text-gray-200">
<p className="text-end">
EN text align end
</p>
<p className="text-end" dir="rtl" lang="ar">
نص عربي في نهاية السطر
</p>
</div>
</div>
}
</Example>

```html
<!-- [!code classes:text-justify] -->
<p class="text-end">So I started to walk into the water...</p>
<p class="text-end" dir="rtl" lang="ar">هنا يبدأ النص...</p>
```

</Figure>

### Responsive design

<ResponsiveDesign element="p" property="text-align" defaultClass="text-left" featuredClass="text-center" />