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

# getComputedStyleProperty()

APISummary
## 介绍

[`Element`](/next/zh/api/lynx-api/main-thread/main-thread-element.md) 接口的 **`getComputedStyleProperty()`** 方法返回元素的指定[计算样式](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Guides/Cascade/Property_value_processing#resolved_value)。

## 语法

```ts
const value = element.getComputedStyleProperty(styleName);
```

### 参数

#### styleName

指定要获取的属性名的字符串。样式名必须是 [kebab-case](https://developer.mozilla.org/zh-CN/docs/Glossary/Kebab_case)。

### 返回值

包含[计算样式](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Guides/Cascade/Property_value_processing#resolved_value)值的字符串。

## 示例

```ts
const width = element.getComputedStyleProperty('width');
const backgroundColor = element.getComputedStyleProperty('background-color');
```

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.main-thread.ElementGetComputedStyle`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/main-thread/ElementGetComputedStyle.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| ElementGetComputedStyle | Yes (3.5) | Yes (3.5) | Yes (3.5) | Yes (3.7) | Yes (3.7) | Yes |

**`ElementGetComputedStyle`**

Create An Animation in MTS

**Specifications:**

- **Web — Supported (version unknown):** Implemented since `@lynx-js/web-core@0.23.1` (lynx-family/lynx-stack#3262).

