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

# left

APISummary
## Introduction

The `left` CSS property participates in specifying the horizontal position of a positioned element. For more information, please refer to property [`position`](/next/api/css/properties/position.md).

The effect of `left` depends on how the element is positioned (i.e., the value of the position property):

- When `position` is set to `absolute` or `fixed`, the `left` property specifies the distance between the element's outer margin of left edge and the inner border of left edge of its containing block. (The containing block is the ancestor to which the element is relatively positioned.)

- When `position` is set to `relative`, the `left` property specifies the distance the element's left edge is moved to the right from its normal position.

When both `left` and `right` are defined, and `width` constraints don't prevent it, the element will stretch to satisfy both. If the element cannot stretch to satisfy both, the `position` of the element is overspecified. When this is the case, the `left` value has precedence when the container is left-to-right; the `right` value has precedence when the container is right-to-left.

## Examples

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

**Entry:** `src/left`
**Bundle:** `dist/left.lynx.bundle`

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

const Left = () => {
  const scrollViewStyle = {
    height: "100%",
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical" style={scrollViewStyle}>
      <view
        style={{
          width: "210px",
          height: "210px",
          border: "5px",
          borderColor: "black",
        }}
      >
        <view
          style={{
            position: "absolute",
            left: "80px",
            width: "50px",
            height: "50px",
            backgroundColor: "red",
          }}
        >
        </view>
        <view
          style={{
            position: "fixed",
            left: "155px",
            width: "50px",
            height: "50px",
            backgroundColor: "green",
          }}
        >
        </view>
        <view
          style={{
            position: "relative",
            left: "155px",
            width: "50px",
            height: "50px",
            backgroundColor: "yellow",
          }}
        >
        </view>
        <view
          style={{
            width: "50px",
            height: "50px",
            backgroundColor: "blue",
          }}
        >
        </view>
      </view>
    </scroll-view>
  );
};

root.render(<Left />);

```

v0.11.0



## Syntax

```css
/* <length> values */
left: 3px;
left: 2rpx;
left: 2.4em;
left: 3rem;

left: 10%;

/* Keyword value */
left: auto;

/* calc */
left: calc(1px + 1px);
```

### Values

#### `auto`

**Default value**.

#### `<length>`

A negative, null, or positive [`<length>`](/next/api/css/data-type/length.md) that represents:

- for absolutely positioned elements, the distance to the left edge of the containing block.

- for relatively positioned elements, the distance that the element is moved to the right of its normal position.

#### `<percentage>`

A `<percentage>` of the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block)'s width.

## Formal definition

| Initial value | auto |
| Applies to | all elements |
| Inherited | no |
| Animatable | yes |
| Percentages | refer to the width of the containing block |


## Formal syntax

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

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

## Compatibility

**Compatibility Table**

**Query:** `css.properties.left`

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

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

**`left`**

participates in setting the horizontal position of a positioned element. It has no effect on non-positioned elements.

**Specifications:**

