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

# background-origin

APISummary
## 介绍

`background-origin` 规定了指定背景图片 [`background-image`](/next/zh/api/css/properties/background-image.md) 属性的原点位置的背景相对区域。

> 注意：当使用 [`background-color`](/next/zh/api/css/properties/background-color.md) 时，此属性无效。

## 使用示例

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

**Entry:** `src/background-origin`
**Bundle:** `dist/background-origin.lynx.bundle`

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

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

  const containerStyles = {
    style1: {
      backgroundOrigin: "content-box" as const,
    },
    style2: {
      backgroundOrigin: "padding-box" as const,
    },
    style3: {
      backgroundOrigin: "border-box" as const,
    },
    style4: {
      backgroundOrigin: "content-box,border-box" as const,
    },
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="fixed_area" style={fixedAreaStyle}>
        <view className="container image1" style={containerStyles.style1}></view>
        <view className="container image1" style={containerStyles.style2}></view>
        <view className="container image1" style={containerStyles.style3}></view>
        <view className="container image2" style={containerStyles.style4}></view>
      </view>
    </scroll-view>
  );
};

root.render(<BackgroundOrigin />);

```

v0.11.0



## 语法

```css
background-origin: border-box;
background-origin: padding-box;
background-origin: content-box;

background-origin: content-box, padding-box;
```

### 取值

- 默认值 **padding-box** 

  背景图片的摆放以 padding 区域为参考

- **border-box** 

  背景图片的摆放以 border 区域为参考

- **content-box** 

  背景图片的摆放以 content 区域为参考

## 形式定义

| 初始值 | padding-box |
| 适用元素 | all elements |
| 是否支持继承 | no |
| 是否支持动画 | no |


## 形式语法

```
border-box | padding-box | content-box
```

## 与 Web 的区别

- 不支持 `inherit` 模式
- 对 `background-color` 不生效

## 兼容性

**Compatibility Table**

**Query:** `css.properties.background-origin`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| background-origin | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`background-origin`**

**Specifications:**

