父容器设置 position: relative;
0.5px 下边距
1 2 3 4 5 6 7 8 9 10
| &::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; border-bottom: 1px solid #dadada; transform: scaleY(.5); transform-origin: left bottom; }
|
0.5px 上边距
1 2 3 4 5 6 7 8 9 10
| &::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-bottom: 1px solid #dadada; transform: scaleY(.5); transform-origin: left top; }
|
0.5px圆角边框
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| &::after { content: ""; box-sizing: border-box; display: block; position: absolute; width: 200%; height: 200%; top: 0; left: 0; right: 0; border: 1px solid rgba(229, 71, 67, .3); border-radius: 50/75rem; transform: scale(.5); transform-origin: left top; }
|
注意 transform 的起点,上边距要用左上角,下边距用左下角,且box-sizing
要设置为border-box
,否则伪元素上下左右各会多1px。