表单标题居右对齐,居中对齐

<form action="javascript:void(0)" method="post">
    <div>
        <label>用户名</label>
        <input type="text" value="" />
    </div>
    <div>
        <label>密码</label>
        <input type="password" value="" />
    </div>
    <div>
        <label>电子邮箱</label>
        <input type="email" value="" />
    </div>
</form>
label{
    /*居右对齐*/
    display: inline-block;
    width: 120px;
    height: 40px;
    text-align: right;
}        

label{
    /*居中对齐*/
    display: inline-block;
    width:120px;
    height: 40px;
    line-height: 40px;
    text-align: justify;
    text-align-last: justify;
}

 

posted @ 2024-10-24 17:24  eternityQSL  阅读(2)  评论(0编辑  收藏  举报