表单标题居右对齐,居中对齐
<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; }