1. 程式人生 > >css 文字兩端對齊小技巧

css 文字兩端對齊小技巧

在這裡有其實現思維的解釋:https://segmentfault.com/a/1190000011336392

我只在此根據自己在開發中實現程式碼做個總結

<div class='div'>
    這裡是文字
</div>
.div {
  width: 120rpx;
  text-align: justify;
}
.div::after {
  content: " ";
  display: inline-block;
  width: 100%;
}

親測可實現效果。