margin-block-end
CSS
property defines the logical block end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and 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-block-end: 10px; /* An absolute length */ margin-block-end: 1em; /* relative to the text size */ margin-block-end: 5%; /* relative to the nearest block container's width */ /* Keyword values */ margin-block-end: auto; /* Global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset;
It corresponds to the
margin-top
,
margin-right
,
margin-bottom
,或
margin-left
property depending on the values defined for
writing-mode
,
direction
,和
text-orientation
.
It relates to
margin-block-start
,
margin-inline-start
,和
margin-inline-end
, which define the other margins of the element.
margin-block-end
property takes the same values as the
margin-left
特性。
| 初始值 |
0
|
|---|---|
| 适用于 |
same as
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'>
<div> <p class="exampleText">Example text</p> </div>
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-rl;
margin-block-end: 20px;
background-color: #c8c800;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Logical Properties and Values Level 1
The definition of 'margin-block-end' in that specification. |
编者草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
margin-block-end
|
Chrome 完整支持 69 | Edge 完整支持 79 |
Firefox
完整支持
41
|
IE 不支持 No | Opera 完整支持 56 | Safari 完整支持 12.1 | WebView Android 完整支持 69 | Chrome Android 完整支持 69 |
Firefox Android
完整支持
41
|
Opera Android 完整支持 48 | Safari iOS 完整支持 12.2 | Samsung Internet Android 完整支持 10.0 |
完整支持
不支持
用户必须明确启用此特征。
margin-top
,
margin-right
,
margin-bottom
,和
margin-left
writing-mode
,
direction
,
text-orientation
block-size
border-block
border-block-color
border-block-end
border-block-end-color
border-block-end-style
border-block-end-width
border-block-start
border-block-start-color
border-block-start-style
border-block-start-width
border-block-style
border-block-width
border-end-end-radius
border-end-start-radius
border-inline
border-inline-color
border-inline-end
border-inline-end-color
border-inline-end-style
border-inline-end-width
border-inline-start
border-inline-start-color
border-inline-start-style
border-inline-start-width
border-inline-style
border-inline-width
border-start-end-radius
border-start-start-radius
inline-size
inset
inset-block
inset-block-end
inset-block-start
inset-inline
inset-inline-end
inset-inline-start
margin-block
margin-block-end
margin-block-start
margin-inline
margin-inline-end
margin-inline-start
max-block-size
max-inline-size
min-block-size
min-inline-size
padding-block
padding-block-end
padding-block-start
padding-inline
padding-inline-end
padding-inline-start