简体   繁体   English

将标签与输入文本水平对齐

[英]horizontally aligning labels with input text

I have a form that should look like this one: http://jsfiddle.net/g6kQK/ 我有一个看起来像这样的表格: http : //jsfiddle.net/g6kQK/

but if I inspect the generated code this is what I get: http://jsfiddle.net/bxA5X/ 但是,如果我检查生成的代码,这就是我得到的: http : //jsfiddle.net/bxA5X/

The problem seems to be with 问题似乎与

display: block;
float: left;

but if delete those attributes nothing changes in my form. 但是,如果删除这些属性,则我的表单没有任何变化。

What is the default property for input type=text in html ? html input type=text的默认属性是什么?

What should I set it to make it aligned with the text? 我应该设置什么使其与文本对齐?

Thanks. 谢谢。

Remove the width from the .cardno div, and move the input element to the outside. 删除.cardno div的width ,然后将input元素移到外部。

    <label>card no</label>
    <div class="cardno">04</div>
    <input type="text" name="codcard"  maxlength="11"/>

Updated Fiddle: http://jsfiddle.net/bxA5X/8/ 更新的小提琴: http : //jsfiddle.net/bxA5X/8/

只需删除diplay:block属性form.usersetting输入[name =“ codcard”]

here is what i got you the answer hope this is what you want... just see this fiddle 这就是我给你的答案,希望这就是你想要的...

   <form id="change_customer_data" class="usersetting" action="/">     

    <label>telephone</label>    
    <input type="text" name="tel" /><br>  

    <label>email</label>&emsp;&emsp;    
    <input type="text" name="email"><br>                

    <label>card no:</label>
    04<input type="text" name="codcard"  maxlength="11"/>

http://jsfiddle.net/bxA5X/8/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM