> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# text-align

APISummary
## 介绍

`text-align` 属性设置文本内容的对齐方式。

## 使用示例

**下面是一个示例: css-api**

**Entry:** `src/text-align`
**Bundle:** `dist/text-align.lynx.bundle`

```tsx
import { root } from "@lynx-js/react";
import "./index.scss";

const TextAlign = () => {
  const containerStyle = {
    width: "100%",
    height: "100%",
    flexDirection: "column" as const,
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="fixed_area">
        <view style={containerStyle}>
          <text className="item left">Filler Text</text>
          <text className="item center">Filler Text</text>
          <text className="item right">Filler Text</text>
        </view>
      </view>
    </scroll-view>
  );
};

root.render(<TextAlign />);

```

v0.11.0



## 语法

```css
/* Keyword values */
text-align: start;
text-align: end;
text-align: left;
text-align: right;
text-align: center;
```

### 取值

- `left`
  行内内容向左侧边对齐。

- `right`
  行内内容向右侧边对齐。

- `center`
  行内内容居中。

- `start`
  文字对齐阅读开始方向侧边。
  `LTR` 模式下等价 `left`；`RTL` 模式下等价 `right`。
  **当 `direction` 为 `normal` 时，`start` 跟随文字内容方向。**

- `end`
  文字对齐阅读开始方向侧边。
  `LTR` 模式下等价 `right`；`RTL` 模式下等价 `left`。

## 形式定义

| 初始值 | start |
| 适用元素 | text |
| 是否支持继承 | yes |
| 是否支持动画 | no |


## 形式语法

```
left | right | center | start | end
```

## 与 Web 的区别

- 不支持 `justify` 和 `justify-all`。

- 不支持 `match-parent`。

## 兼容性

**Compatibility Table**

**Query:** `css.properties.text-align`

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/44-text-align.json) · [MDN](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-align)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| text-align | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`text-align`**

**Specifications:**

