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
.
Интерактивный пример
margin-inline-end: 20px;
writing-mode: horizontal-tb;
margin-inline-end: 20px;
writing-mode: vertical-rl;
margin-inline-end: 20%;
writing-mode: horizontal-tb;
direction: rtl;
<section id="default-example">
<div id="container">
<div class="col">One</div>
<div class="col transition-all" id="example-element">Two</div>
<div class="col">Three</div>
</div>
</section>
#container {
width: 300px;
height: 200px;
display: flex;
align-content: flex-start;
justify-content: flex-start;
}
.col {
width: 33.33%;
border: solid #ce7777 10px;
background-color: #2b3a55;
color: white;
flex-shrink: 0;
}
#example-element {
border: solid 10px #ffbf00;
background-color: #2b3a55;
unicode-bidi: bidi-override;
}
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 |
Совместимость с браузерами
Смотрите также
margin-inline-start
- The mapped physical properties:
margin-top
,margin-right
,margin-bottom
, andmargin-left
writing-mode
,direction
,text-orientation