 1px边框
          1px边框
        
  # 通过 border + 伪元素 + transform 实现
 原理:设置1px边框,通过设置
transformscale来进行缩放。
0.5px边框
 上边框
 右边框
 下边框
 左边框
 上下边框
 左右边框
<template>
  <div class="demo-onepxline">
    <div class="elem b-1px">0.5px边框</div>
    <div class="elem bt-1px">上边框</div>
    <div class="elem br-1px">右边框</div>
    <div class="elem bb-1px">下边框</div>
    <div class="elem bl-1px">左边框</div>
    <div class="elem bt-1px bb-1px">上下边框</div>
    <div class="elem bl-1px br-1px">左右边框</div>
  </div>
</template>
<script>
export default {
  name: 'OnePxLine'
}
</script>
<style lang="scss">
.demo-onepxline {
  display: flex;
  flex-wrap: wrap;
  .elem {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 40px;
    margin: 20px 10px 0 0;
    background-color: var(--bodyBg);
    &::before, &::after {
      position: absolute;
      content: '';
    }
  }
  .b-1px::before {
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    border: 1px solid var(--textLightenColor);
    transform: scale(0.5);
    transform-origin: 0 0;
  }
  .bt-1px::before {
    top: 0;
    left: 0;
    width: 100%;
    transform: scaleY(0.5);
    border-top: 1px solid var(--textLightenColor);
  }
  .br-1px::after {
    top: 0;
    right: 0;
    height: 100%;
    transform: scaleX(0.5);
    border-right: 1px solid var(--textLightenColor);
  }
  .bb-1px::after {
    bottom: 0;
    right: 0;
    width: 100%;
    transform: scaleY(0.5);
    border-bottom: 1px solid var(--textLightenColor);
  }
  .bl-1px::before {
    top: 0;
    left: 0;
    height: 100%;
    transform: scaleX(0.5);
    border-left: 1px solid var(--textLightenColor);
  }
}
</style>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
上次更新: 2021-07-07 09:07:41