margin-right

介绍

设置元件右侧的外边距区域。正值使其远离相邻元件,负值使其更加靠近。

使用示例

语法

/* <length> values */
margin-right: 0.5em;
margin-right: 0;
margin-right: 2rpx;

/* <percentage> value */
margin-right: 10%;

取值

0px

默认值

<length>

<length> 定义了一个确定的宽度值。可以为负值。

<percentage>

相对于包含块的宽度,以百分比值为外边距。

auto

让布局流程自己选择一个合适的外边距。

INFO

目前支持在弹性布局网格布局线性布局的非 position: fixed/absolute/sticky 子元件中使用。

其中,对于线性布局,仅支持在交叉轴方向上使用 auto

形式定义

初始值0
适用元素所有元件
是否支持继承
是否支持动画yes
百分比refer to the width of the containing block

形式语法

margin-right =
  <length-percentage>  |
  auto                 |

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

与 Web 的区别

mdn: margin-right

  1. 在 Lynx 下,margin 任何情况都不会重叠。
  2. 目前支持在弹性布局网格布局线性布局的非 position: fixed/absolute/sticky 子元件中使用 auto。其中,对于线性布局,仅支持在交叉轴方向上的外边距 auto 值。

兼容性

LCD tables only load in the browser

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。