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

APISummary
## Introduction

The `margin-bottom` CSS property sets the margin area on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.

## Examples

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

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

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

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

  return (
    <scroll-view className="root" scroll-orientation="vertical" style={scrollViewStyle}>
      <view className="con">
        <text
          className="intro"
          style={{
            marginTop: "10px",
            marginBottom: "30px",
          }}
        >
          1
        </text>
        <text className="intro2">
          2
        </text>
      </view>
    </scroll-view>
  );
};

root.render(<MarginBottom />);

```

v0.11.0



## Syntax

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

/* <percentage> value */
margin-bottom: 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.

#### `<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).

#### `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 | yes |
| Percentages | refer to the width of the containing block |


## Formal syntax

```
margin-bottom =
  <length-percentage>  |
  auto                 |

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

## Differences from the Web

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

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.

## Compatibility

**Compatibility Table**

**Query:** `css.properties.margin-bottom`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| margin-bottom | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes | 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 | Yes (3.4) | 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-bottom`**

**Specifications:**

**`supported_in_flex_layout`**

Supported in Flexible Box Layout

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

**`supported_in_flex_layout.auto`**

<code>auto</code>

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

**`supported_in_linear_layout`**

Supported in Linear Layout

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/41-margin-bottom.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/41-margin-bottom.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/41-margin-bottom.json)

**`supported_in_grid_layout`**

Supported in Grid Layout

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

**`supported_in_grid_layout.auto`**

<code>auto</code>

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

