## margin-bottom
margin-bottom 属性设置与元素相关联的盒子模型的下外边距。可以为负值
### uni-app x 兼容性
Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61
### App平台拍平(flatten)兼容性 @flatten_compatibility
| Android(Vapor) | iOS(Vapor) | HarmonyOS(Vapor) |
| :- | :- | :- |
| 5.21 | 5.11 | 5.0 |
### 语法
```
margin-bottom: | | auto;
```
### 值限制
- length
- percentage
### margin-bottom 的属性值
| 名称 | 兼容性 | 描述 |
| :- | :- | :- |
| auto | Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61 | 由浏览器自己选择一个合适的值。参见 margin。 |
### 默认值 @default-value
`0`
**注意**
- app平台不支持外边距折叠(上下外边距折叠合并为单个边距,其大小为两个边距中的最大值),折叠规则参考[CSS的外边距折叠](https://developer.mozilla.org/zh-CN/docs/Web/CSS/CSS_box_model/Mastering_margin_collapsing)
- HBuilderX3.98以下版本当 position 设置为 fixed 或 absolute 时, margin不支持 auto
### 示例
示例为[hello uni-app x alpha分支](https://gitcode.com/dcloud/hello-uni-app-x/blob/prod_alpha/pages/CSS/margin/margin-bottom.uvue),与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例[另见](https://gitcode.com/dcloud/hello-uni-app-x/blob/master//pages/CSS/margin/margin-bottom.uvue)
::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/CSS/margin/margin-bottom
> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/CSS/margin/margin-bottom
>示例
```vue
说明:左边是正常版本,右边是拍平版本
margin-bottom: 25px
margin-bottom: 10%
scroll-view 组件
margin-bottom: 10% 和 margin-bottom: 30px
setProperty 设置与 getPropertyValue 获取
view 组件
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActual}}
view
text 组件
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActualText}}
红色
text
蓝色
image 组件
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActualImage}}
view 组件拍平
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActualFlat}}
view
text 组件拍平
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActualTextFlat}}
红色
text
蓝色
image 组件拍平
设置值: {{data.marginBottom}}
获取值: {{data.marginBottomActualImageFlat}}
第一个枚举值,'' (空字符串) - 空值情况
native-view组件: margin-bottom: 25px 和 10%
```
:::
### 参见
- [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-bottom)
- [相关 Bug](https://issues.dcloud.net.cn/?mid=css.properties.margin.margin-bottom)