我想作為一個前端工作者,總會遇到這樣的場景,一個表單展示的字段標題有4個字也有2個字的時候,這樣子同時存在想展示的美觀一點,就需要字體兩端對齊了,其實實現方式很簡單,我針對其中一種來做下介紹,以后方法在補上更新。
html :
<p class="cell-label-text"></p>
css :
.cell-label-text{
width:2rem;
text-aligh:justify;
overflow:hidden;
}
.cell-label-text:after{
display:inline-block;
content:"";
width:2rem;
text-aligh:justify;
overflow:hidden;
}