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

# padding-top

APISummary
## 介绍

指定一个元件内容与上边界的距离，该属性不能为负值。

## 使用示例

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

**Entry:** `src/padding-top`
**Bundle:** `dist/padding-top.lynx.bundle`

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

import imageUrl from "../../resource/lynx.png";

const PaddingTop = () => {
  const containerStyle = {
    paddingTop: "10px",
    paddingBottom: "30px",
  };

  return (
    <view className="con" style={containerStyle}>
      <text className="intro2">2</text>
    </view>
  );
};

root.render(<PaddingTop />);

```

v0.11.0



## 语法

```css
/* <length> values */
padding-top: 0.5em;
padding-top: 0;

/* <percentage> value */
padding-top: 10%;
```

### 取值

#### `0px`

**默认值**。

#### `<length>`

[`<length>`](/next/zh/api/css/data-type/length.md) 定义为一个绝对值。不能为负值。

#### `<percentage>`

相对于[包含块](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Containing_block)的行内尺寸（宽度）的百分比。必须是非负值。

## 形式定义

| 初始值 | 0 |
| 适用元素 | 所有元件 |
| 是否支持继承 | 否 |
| 是否支持动画 | yes |
| 百分比 | refer to the width of the containing block |


## 形式语法

```
padding-top =
  <length-percentage [0,∞]>

<length-percentage> =
  <length>      |
  <percentage>
```

## 兼容性

**Compatibility Table**

**Query:** `css.properties.padding-top`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| padding-top | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`padding-top`**

**Specifications:**

