通过 transform:scale 实现

.element {
  border: 1px solid red;
  transform: scale(0.5);
}

通过背景实现

.element {
  height: 2px;
  background-image: linear-gradient(0deg, red 50%, transparent 50%);
}