rvby

在平常的开发过程中,对于text-align一般用到的是left,center,right,这三个属性都不会陌生。然而,对于justify的使用我却是很陌生。首先有个比较简单的例子。

如下代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        span{
            width: 60px;
            text-align: justify;
            float: left;
        }
        span:after{
            content:\'.\';
            width: 100%;
            display: inline-block;
            overflow: hidden;
            height: 0;
        }
        input{
            width: 100px;
        }
    </style>
</head>
<body>
    <div class="demo">
        <span>昵称</span>:<input type="text" style = \'width: 100px\'><br><br>
        <span>电子邮箱</span>:<input type="email" style = \'width: 100px;\'>
    </div>
</body>
</html>

效果图如下:

此处注意冒号“:”必须在<span>的外面。否则不生效。

分类:

技术点:

相关文章:

  • 2021-06-12
  • 2021-10-07
  • 2022-01-08
  • 2022-01-15
  • 2021-12-01
  • 2019-11-20
  • 2021-11-21
  • 2021-12-23
猜你喜欢
  • 2021-11-21
  • 2021-12-01
  • 2021-12-01
  • 2021-11-21
  • 2021-11-06
  • 2021-11-21
相关资源
相似解决方案