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

# margin-inline-end

APISummary
## Introduction

The `margin-inline-end` CSS property defines the logical inline end margin of an element.

In `LTR` direction, it corresponds to the [`margin-right`](/next/api/css/properties/margin-right.md) property.
In `RTL` direction, it corresponds to the [`margin-left`](/next/api/css/properties/margin-left.md) property.

## Examples

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

**Entry:** `src/margin-inline-end`
**Bundle:** `dist/margin-inline-end.lynx.bundle`

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

const MarginInlineEnd = () => {
  const [rtl, setRtl] = useState(false);

  const containerStyle = {
    direction: rtl ? "rtl" : "ltr" as "rtl" | "ltr",
  };

  const introStyle = {
    marginInlineStart: "10px",
    marginInlineEnd: "50px",
  };

  return (
    <>
      <view className="con" bindtap={() => setRtl(!rtl)} style={containerStyle}>
        <text className="intro" style={introStyle}>1</text>
        <text className="intro2">2</text>
      </view>
      <text>Click above to switch, current {rtl ? "rtl" : "ltr"}</text>
    </>
  );
};

root.render(<MarginInlineEnd />);

```

v0.11.0



## Syntax

```css
/* <length> values */
margin-inline-end: 0.5em;
margin-inline-end: 0px;
margin-inline-end: 2rpx;

/* <percentage> value */
margin-inline-end: 10%;
```

### Values

#### `0px`

**Default value**.

#### `<length>`

[`<length>`](/next/api/css/data-type/length.md) means that the size of the margin as a fixed value, can be positive, zero, or negative.

#### `<percentage>`

The size of the margin as a percentage, relative to the inline size (width) of the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block). It can be positive, zero, or negative.

#### `auto`

Selects a suitable margin to use. For example, in certain cases this value can be used to center an element.

:::info
Currently, Lynx supports using `auto` in flex, grid and [linear](/next/guide/ui/layout/linear-layout.md) children that are not with [`position:fixed/absolute/sticky`](/next/api/css/properties/position.md).

Additionally, in linear layout, it only supports using `auto` on the cross axis. We plan to support using `auto` on the main axis in the future.
:::

## Formal definition

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


## Formal syntax

```
margin-inline-end =
  <length-percentage>  |
  auto                 |

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

## Differences from the Web

[mdn: margin-inline-end](https://developer.mozilla.org/en/docs/Web/CSS/margin-inline-end)

1. In Lynx, margins will not collapse at any time.
2. Currently, Lynx supports using `auto` in flex, grid and [linear](/next/guide/ui/layout/linear-layout.md) children that are not with [`position:fixed/absolute/sticky`](/next/api/css/properties/position.md). Additionally, in linear layout, it only supports using `auto` on the cross axis. We plan to support using `auto` on the main axis in the future.
3. Lynx does not support writing mode.

## Compatibility

**Compatibility Table**

**Query:** `css.properties.margin-inline-end`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| margin-inline-end | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| supported&#95;in&#95;flex&#95;layout | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| supported&#95;in&#95;flex&#95;layout.auto | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| supported&#95;in&#95;linear&#95;layout | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| supported&#95;in&#95;linear&#95;layout.nested&#95;value&#95;1 | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| supported&#95;in&#95;linear&#95;layout.nested&#95;value&#95;2 | No | No | No | No | No | Yes |
| supported&#95;in&#95;grid&#95;layout | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (2.1) | Yes (2.1) | Yes |
| supported&#95;in&#95;grid&#95;layout.auto | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (2.1) | Yes (2.1) | Yes |

**`margin-inline-end`**

**Specifications:**

**`supported_in_flex_layout`**

Supported in Flexible Box Layout

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_flex_layout.auto`**

<code>auto</code>

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_linear_layout`**

Supported in Linear Layout

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_linear_layout.nested_value_1`**

<code>auto</code> in cross-axis

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_linear_layout.nested_value_2`**

<code>auto</code> in main-axis

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_grid_layout`**

Supported in Grid Layout

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

**`supported_in_grid_layout.auto`**

<code>auto</code>

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/151-margin-inline-end.json)

