preface

Today, the UI made a request to justify text from right to left on the form. At first I thought of text-align:justify, but it didn’t work as well as it should. I searched the web and found that text-align: last does

CSS code

So I restyled the class as follows:

.van-field__label {
      text-align: justify;
      width: 4rem;
      text-align-last: justify;
    }
Copy the code

At this point, I thought I had no problem, but on aN ios device

The effect remains the same because Safari doesn’t support text-align-last

The solution is also very simple, through the pseudo-class :after processing

Add the following code

  .van-field__label:after {
      content: '';
      width: 100%;
      display: inline-block;
   }
Copy the code

Implementation effect