我有一組絕對定位元素,其尺寸測量值爲rem
's,並且使用transform: translateX
對齊。在絕對定位和轉換元素中添加邊距
我需要在1rem
之間添加空格,但margin-right
/margin-left
屬性不起作用,我似乎無法找到解決方案。
CodePen:https://codepen.io/pen/
CSS
.box {
height: 6rem;
width: 6rem;
background: blue;
display: inline-block;
position: absolute;
}
.box2 { transform: translateX(100%); background: red; }
.box3 { transform: translateX(200%); background: yellow; }
.box4 { transform: translateX(300%); }
HTML
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
我不想到你居然保存的筆。 –