> 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-shadow

APISummary
## 介绍

`text-shadow` 属性为文字添加阴影。阴影值由元件在 X 和 Y 方向的偏移量、模糊半径和颜色值组成。

## 使用示例

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

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

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

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

  const headerStyle = {
    backgroundColor: "#ccc",
    marginTop: "10px",
  };

  const noneStyle = {
    textShadow: "none" as const,
  };

  const singleStyle = {
    textShadow: "1px 1px 2px #558abb" as const,
  };

  const multiStyle = {
    textShadow: "1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue" as const,
  };

  const rgbaStyle = {
    textShadow: "0 .005px .01rem rgba(70, 70, 70, .3)" as const,
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="fixed_area">
        <view style={containerStyle}>
          <text style={headerStyle}>text-shadow</text>
          <text style={noneStyle}>text-shadow: none;</text>
          <text style={singleStyle}>text-shadow: 1px 1px 2px #558abb;</text>
          <text style={multiStyle}>text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue;</text>
          <text style={rgbaStyle}>text-shadow: 0 .005px .01rem rgba(70, 70, 70, .3);</text>
        </view>
      </view>
    </scroll-view>
  );
};

root.render(<TextShadow />);

```

v0.11.0



## 语法

```css
/* offset-x | offset-y | blur-radius | color */
text-shadow: 1px 1px 2px black;

/* color | offset-x | offset-y | blur-radius */
text-shadow: #fc0 1px 0 10px;

/* offset-x | offset-y | color */
text-shadow: 5px 5px #558abb;

/* color | offset-x | offset-y */
text-shadow: white 2px 5px;

/* offset-x | offset-y
/* Use defaults for color and blur-radius */
text-shadow: 5px 10px;
```

## 形式定义

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


## 形式语法

```
none | [ <length>{3} <color> ]
```

## 与 Web 的区别

- 暂时只支持指定单层阴影，即使指定了多层阴影，也只有第一层会生效。

- 指定阴影时，`offset-x`, `offset-y`, `blur-radius` 和 `color` 都不能省略。

## 注意事项

- 在某些 Android 平台上，`blur-radius` 的值为 0 时，阴影可能无法绘制。

## 兼容性

**Compatibility Table**

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

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

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

**`text-shadow`**

**Specifications:**

