margin-inline-end CSS property defines the logical inline end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. In other words, it corresponds to the margin-top , margin-right , margin-bottom or margin-left property depending on the values defined for writing-mode , direction ,和 text-orientation .

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

句法

/* <length> values */
margin-inline-end: 10px;   /* An absolute length */
margin-inline-end: 1em;    /* relative to the text size */
margin-inline-end: 5%;     /* relative to the nearest block container's width */
/* Keyword values */
margin-inline-end: auto;
/* Global values */
margin-inline-end: inherit;
margin-inline-end: initial;
margin-inline-end: unset;
					

It relates to margin-block-start , margin-block-end ,和 margin-inline-start , which define the other margins of the element.

margin-inline-end property takes the same values as the margin-left 特性。

形式定义

初始值 0
适用于 如同 margin
继承 no
百分比 depends on layout model
计算值 if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto
动画类型 a length

形式句法

<'margin-left'>
					

范例

Setting inline end margin

HTML

<div>
  <p class="exampleText">Example text</p>
</div>
					

CSS

div {
  background-color: yellow;
  width: 120px;
  height: 120px;
}
.exampleText {
  writing-mode: vertical-lr;
  margin-inline-end: 20px;
  background-color: #c8c800;
}
					

结果

规范

规范 状态 注释
CSS Logical Properties and Values Level 1
The definition of 'margin-inline-end' in that specification.
编者草案 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
margin-inline-end Chrome 完整支持 69
完整支持 69
完整支持 2 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Edge 完整支持 79
完整支持 79
完整支持 79 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Firefox 完整支持 41
完整支持 41
不支持 38 — 51 Disabled
Disabled From version 38 until version 51 (exclusive): this feature is behind the layout.css.vertical-text.enabled preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
完整支持 3 Alternate Name
Alternate Name Uses the non-standard name: -moz-margin-end
IE 不支持 No Opera 完整支持 56
完整支持 56
完整支持 15 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Safari 完整支持 12.1
完整支持 12.1
完整支持 3 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
WebView Android 完整支持 69
完整支持 69
完整支持 2 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Chrome Android 完整支持 69
完整支持 69
完整支持 18 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Firefox Android 完整支持 41
完整支持 41
不支持 38 — 51 Disabled
Disabled From version 38 until version 51 (exclusive): this feature is behind the layout.css.vertical-text.enabled preference (needs to be set to true ). To change preferences in Firefox, visit about:config.
完整支持 4 Alternate Name
Alternate Name Uses the non-standard name: -moz-margin-end
Opera Android 完整支持 48
完整支持 48
完整支持 14 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Safari iOS 完整支持 12.2
完整支持 12.2
完整支持 3 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end
Samsung Internet Android 完整支持 10.0
完整支持 10.0
完整支持 1.0 Alternate Name
Alternate Name Uses the non-standard name: -webkit-margin-end

图例

完整支持

完整支持

不支持

不支持

用户必须明确启用此特征。

用户必须明确启用此特征。

使用非标名称。

使用非标名称。

另请参阅

元数据

  • 最后修改: