css两行文字两端对齐

效果如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>JS Bin</title>
    <style>
        span{
            display:inline-block;
            width:4.5em;
            text-align:justify;
            font-size:20px;
            overflow:hidden;
            height:20px;
            line-height:20px;
        }
        span:after{
            content:"";
            display:inline-block;
            width:100%;
        }
    </style>
</head>
<body>
<span>一字</span><br/>
<span>两个字</span><br/>
<span>有四个字</span>
</body>
</html>

发布了248 篇原创文章 · 获赞 602 · 访问量 108万+

猜你喜欢

转载自blog.csdn.net/qq_32963841/article/details/105087162