margin-inline-end
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
* Some parts of this feature may have varying levels of support.
Экспериментальная возможность: Это экспериментальная технология
Так как спецификация этой технологии ещё не стабилизировалась, смотрите таблицу совместимости по поводу использования в различных браузерах. Также заметьте, что синтаксис и поведение экспериментальной технологии может измениться в будущих версиях браузеров, вслед за изменениями спецификации.
CSS Свойство margin-inline-end определяет отступ логического края элемента, который сопоставляется с физическим отступом в зависимости от режима написания, направленности и расположения текста. То есть оно соответствует margin-top, margin-right, margin-bottom или margin-left свойству в зависимости от числа определяющего writing-mode, direction, и text-orientation.
Интерактивный пример
Syntax
/* <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, and margin-inline-start, which define the other margins of the element.
| Начальное значение | 0 |
|---|---|
| Применяется к | с таким же margin |
| Наследуется | нет |
| Проценты | зависит от модели макета |
| Обработка значения | если указано как длина - абсолютная длина; если указано как проценты - заданное значение; в противном случае auto |
| Animation type | длина |
Values
The margin-inline-end property takes the same values as the margin-left property.
Formal syntax
margin-inline-end =
<'margin-top'>
<margin-top> =
<length-percentage> |
auto |
<anchor-size()>
<length-percentage> =
<length> |
<percentage>
<anchor-size()> =
anchor-size( [ <anchor-name> || <anchor-size> ]? , <length-percentage>? )
<anchor-name> =
<dashed-ident>
<anchor-size> =
width |
height |
block |
inline |
self-block |
self-inline
Example
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;
}
Specification
| Specification |
|---|
| CSS Logical Properties and Values Level 1 # margin-properties |
Совместимость с браузерами
BCD tables only load in the browser
Смотрите также
margin-inline-start- The mapped physical properties:
margin-top,margin-right,margin-bottom, andmargin-left writing-mode,direction,text-orientation