HTML输入[type=text]占用了行上的剩余空间

HTML输入[type=text]占用了行上的剩余空间,html,css,internet-explorer-7,width,Html,Css,Internet Explorer 7,Width,我已经尝试了很多次,试图让它在没有使用IE7+中的表的情况下成功运行,但都没有成功 工作但不太理想的代码: <table> <tr> <td><label for="address">Address</label></td> <td><input type="text" name="address" value="" id="address" style="width: 100%;"/&

我已经尝试了很多次,试图让它在没有使用IE7+中的表的情况下成功运行,但都没有成功

工作但不太理想的代码:

<table>
  <tr>
    <td><label for="address">Address</label></td>
    <td><input type="text" name="address" value="" id="address" style="width: 100%;"/></td>
    <td><a href="#">Find</a></td>
  </tr>
</table>

地址
这样做的目的是:地址[输入文本]查找 它们将全部放在一行上,输入字段将占用100%的可用空间,而不会将标签或a推到下一行

我一辈子都不能在没有桌子的情况下工作

输入,评论,链接感谢

在同一屏幕上看到这两个备选方案。

在同一屏幕上看到这两个备选方案。

请参见:

这是一个很好的解决方案,适用于IE7+更大版本和所有现代浏览器

这与@CyberDude的第二个解决方案非常相似

HTML:

.formLine {
    overflow: hidden;
    background: #ccc
}
.formLine input {
    width: 100%
}
.formLine label {
    float: left
}
.formLine span {
    display: block;
    overflow: hidden;
    padding: 0 5px
}
.formLine a {
    float: right
}
.formLine input, .formLine a { 
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box
}

地址
CSS:

.formLine {
    overflow: hidden;
    background: #ccc
}
.formLine input {
    width: 100%
}
.formLine label {
    float: left
}
.formLine span {
    display: block;
    overflow: hidden;
    padding: 0 5px
}
.formLine a {
    float: right
}
.formLine input, .formLine a { 
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box
}
请参见:

这是一个很好的解决方案,适用于IE7+更大版本和所有现代浏览器

这与@CyberDude的第二个解决方案非常相似

HTML:

.formLine {
    overflow: hidden;
    background: #ccc
}
.formLine input {
    width: 100%
}
.formLine label {
    float: left
}
.formLine span {
    display: block;
    overflow: hidden;
    padding: 0 5px
}
.formLine a {
    float: right
}
.formLine input, .formLine a { 
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box
}

地址
CSS:

.formLine {
    overflow: hidden;
    background: #ccc
}
.formLine input {
    width: 100%
}
.formLine label {
    float: left
}
.formLine span {
    display: block;
    overflow: hidden;
    padding: 0 5px
}
.formLine a {
    float: right
}
.formLine input, .formLine a { 
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box
}

非常感谢你!这个JSFIDLE站点也不错!非常感谢你!这个JSFIDLE站点也不错!