@mixin setTopLine($c: #C7C7C7) {
	content: " ";
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	height: 1px;
	border-top: 1px solid $c;
	color: $c;
	transform-origin: 0 0;
	transform: scaleY(0.5);
}

@mixin setBottomLine($c: #C7C7C7) {
	content: " ";
	position: absolute;
	left: 0;
	bottom: 0;
	right: 0;
	height: 1px;
	border-bottom: 1px solid $c;
	color: $c;
	transform-origin: 0 100%;
	transform: scaleY(0.5);
}

@mixin setLeftLine($c: #C7C7C7) {
	content: " ";
	position: absolute;
	left: 0;
	top: 0;
	width: 1px;
	bottom: 0;
	border-left: 1px solid $c;
	color: $c;
	transform-origin: 0 0;
	transform: scaleX(0.5);
}

@mixin setRightLine($c: #C7C7C7) {
	content: " ";
	position: absolute;
	right: 0;
	top: 0;
	width: 1px;
	bottom: 0;
	border-right: 1px solid $c;
	color: $c;
	transform-origin: 100% 0;
	transform: scaleX(0.5);
}

@mixin setLine($c: #C7C7C7) {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 200%;
  border: 1px solid $c;
  color: $c;
  height: 200%;
  transform-origin: left top;
  transform: scale(0.5);
}

.cpm-1px, .cpm-1px-t, .cpm-1px-b, .cpm-1px-tb, .cpm-1px-l, .cpm-1px-r, .cpm-1px-lr {
  position: relative;
}

.cpm-1px {
  &:before {
    @include setLine();
  }
}

.cpm-1px-t {
  &:before {
    @include setTopLine();
  }
}

.cpm-1px-b {
  &:after {
    @include setBottomLine();
  }
}

.cpm-1px-tb {
  &:before {
    @include setTopLine();
  }
  &:after {
    @include setBottomLine();
  }
}

.cpm-1px-l {
  &:before {
    @include setLeftLine();
  }
}

.cpm-1px-r {
  &:after {
    @include setRightLine();
  }
}

.cpm-1px-lr {
  &:before {
    @include setLeftLine();
  }
  &:after {
    @include setRightLine();
  }
}

// 一下为less的实现方案，原理一致：

// .setLine(@c: #C7C7C7) {
//   content: " ";
//   position: absolute;
//   left: 0;
//   top: 0;
//   width: 200%;
//   border: 1px solid @c;
//   color: @c;
//   height: 200%;
//   transform-origin: left top;
//   transform: scale(0.5);
// }

// .cpm-1px {
//   position: relative;
// }

// .cpm-1px {
//   &:before {
//     .setLine();
//   }
// }