好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

css实现文本两端对齐的方法

本篇文章介绍了使用css实现文本两端对齐的效果,具有一定的参考价值,感兴趣的朋友可以看看。

//html<div class="item">
    <span class="label" >{{item.label}}</span>:    <span class="value">{{item.value}}</span></div>
//scss
.item {
    height: 32px;
    line-height: 32px;
    margin-bottom: 8px;
    .label {
        display: inline-block;
        height: 100%;
        width: 100px;
        text-align: justify;
        vertical-align: top;
        &::after {
            display: inline-block;
            width: 100%;
            content: '';
            height: 0;
        }
    }
    .value {
        padding-right: 10px;
    }
}
//scss
.item {
    margin-bottom: 8px;
    .label {
        display: inline-block;
        height: 100%;
        min-width: 100px;
        text-align: justify;
        text-align-last: justify;
    }
    .value {
        padding-right: 10px;
    }
}

相比第一种实现,第二种实现方式就简单了不少,不过该属性有兼容性问题,大家可以根据情况决定实现方式。

( 推荐学习:CSS教程 )

以上就是css实现文本两端对齐的方法的详细内容,更多请关注Gxlcms其它相关文章!

查看更多关于css实现文本两端对齐的方法的详细内容...

  阅读:47次