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

# transform-origin

APISummary
## Introduction

The transform-origin CSS property sets the origin for an element's transformations.

## Examples

**This is an example below: css-api**

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

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

const TransformOrigin = () => {
  const emptyBoxStyle = {
    position: "absolute",
    width: "100px",
    height: "100px",
    border: "1px solid black",
  } as const;

  const redBoxStyle = {
    position: "absolute",
    width: "100px",
    height: "100px",
    backgroundColor: "red",
    transform: "rotate(45rad)",
  } as const;

  const greenBoxStyle = {
    position: "absolute",
    width: "100px",
    height: "100px",
    backgroundColor: "green",
    transformOrigin: "50% top",
    transform: "rotate(45rad)",
  } as const;

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="intro">
        <view style={redBoxStyle} />
        <view style={emptyBoxStyle} />
      </view>
      <view className="intro">
        <view style={greenBoxStyle} />
        <view style={emptyBoxStyle} />
      </view>
    </scroll-view>
  );
};

root.render(<TransformOrigin />);

```

v0.11.0



## Syntax

```scss
/* x-offset | default */
transform-origin: 2px;
transform-origin: bottom;

/* x-offset | y-offset */
transform-origin: 3cm 2px;

/* x-offset-keyword | y-offset */
transform-origin: left 2px;

/* x-offset-keyword | y-offset-keyword */
transform-origin: right top;

/* x-offset | y-offset */
transform-origin: 2px 30%;

/* x-offset-keyword | y-offset */
transform-origin: left 5px;

/* x-offset-keyword | y-offset-keyword */
transform-origin: right bottom;
```

### Values

The value of the `transform-origin` can be one or two. **The first value represents `x-offset`**, **the second value represents `y-offset`**, **separated by a space**.

#### x-offset

The value of `x-offset` can be length `<length>`, percentage `<x-percentage>`, keyword `<x-offset-keyword>`

- **length**
  Length value, the unit is px,rem,rpx, etc.

- **x-percentage**
  Percentage relative to parent View**Width**.

- **x-offset-keyword**

| Keyword | Value |
| ------- | ----- |
| left    | 0%    |
| center  | 50%   |
| right   | 100%  |

#### y-offset

The value of `y-offset` can be length `<length>`, percentage `<y-percentage>`, keyword `<y-offset-keyword>`

- **length**
  Length value, the unit is px,rem,rpx, etc.

- **y-percentage**
  Percentage relative to parent View**Height**.

- **y-offset-keyword**

| Keyword | Value |
| ------- | ----- |
| top     | 0%    |
| center  | 50%   |
| bottom  | 100%  |

## Formal definition

| Initial value | empty value |
| Applies to | all elements |
| Inherited | no |
| Animatable | yes |


## Difference from W3C

- Transform-origin is not supported for z-axis

## Notes

- The first value of transform-origin always means `x-offset`, the second value always means `y-offset`, please do not write inverse.

## Compatibility

**Compatibility Table**

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

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/77-transform-origin.json) · [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin)

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

**`transform-origin`**

**Specifications:**

