输入文本框和宽度100% [英] Input text box and width 100%
问题描述
我正在写一个简单的表格,将一些数据发送到数据库。
I'm writing a simple form for sending some data to a database.
我在自己的公司使用它,所以我不需要一个完美的样式。
I use it in my own company so I don't need to have a perfect style.
我使用一个表格来布局(这在本申请中是可以的)。
I am using a table for the layout (this is okay in this application).
<table width="500px" style="border:1px solid black; overflow:hidden">
<tr>
<td>Born <input type="text" name="nato_pf" /></td>
</tr>
</table>
我想将输入文本的宽度设置为100% ),但是,如果我这样做,输入文本换行。
I would like to set the width of the input text to 100% (to the end of the line) , but, if I do that, the input text wraps to a new line.
我发现解决方案只使用div,他们不是我的。
I have found solutions only using div and they are not for me at the moment.
感谢!
编辑:有时候我有两个输入)在同一行,所以我想我不能添加其他 td
标签。
Sometimes I have two input (with different sizes) on the same line, so I think I cannot add other td
tags.
推荐答案
table {
border:1px solid black;
width: 200px;
}
.left {
float: left;
}
.left2 {
overflow: hidden;
padding: 0 4px;
}
.left2>input {
width: 100%
}
<table>
<tr>
<td>
<label class="left">Born</label>
<div class="left2">
<input type="text" name="nato_pf" />
</div>
</td>
</tr>
</table>
这篇关于输入文本框和宽度100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!