The mapped padding properties of padding-inline-start
, padding-inline-end
, padding-block-start
, and padding-inline-end
can be used instead of their physical counterparts.
In this example, there are two boxes. One has physical padding properties set and the other uses logical padding properties. With a writing-mode
of horizontal-tb
, both boxes should appear the same.
Try changing the direction
property to rtl
to cause the boxes to display in a right-to-left direction. The padding on the first box will stay in the same place, whereas the padding on the inline dimension of the second box will switch.
You can also try changing the writing-mode
from horizontal-tb
to vertical-rl
. Again, notice how the padding stays in the same place for the first box, but switches around to follow the text direction in the second.
<div class="container">
<div class="physical box">
padding-top: 5px<br />
padding-right: 0<br />
padding-bottom: 2em<br />
padding-left: 50px
</div>
<div class="logical box">
padding-block-start: 5px<br />
padding-inline-end: 0<br />
padding-block-end: 2em<br />
padding-inline-start: 50px
</div>
</div>
.box {
writing-mode: horizontal-tb;
direction: ltr;
}
.physical {
padding-top: 5px;
padding-right: 0;
padding-bottom: 2em;
padding-left: 50px;
}
.logical {
padding-block-start: 5px;
padding-inline-end: 0;
padding-block-end: 2em;
padding-inline-start: 50px;
}