0

在这个例子中只有 Internet Explorer 9 或 10 : http://jsfiddle.net/QQxgg/ 如果我放一个主字段集的宽度,例如 655px,文本的标签比正常的大。

在 Firefox 和 Chrome 中,标签大小是自动宽度,所以行为 OK。是否可以在 Internet Explorer 中指定字段集的宽度和标签自动宽度?谢谢。

即9,10

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
fieldset {
width: 655px;
}

fieldset {
    display: table;
}
fieldset p {
    display: table-row;
}
fieldset input, 
fieldset select, 
fieldset label {
    display: table-cell;
    margin: 3px;    
}
fieldset label {
    text-align: right;
}

</style>
</head>
<body>

<fieldset>          
<p><label>First Name: </label><input type="text" /></p>
<p><label>Second Name: </label><input type="text" /></p>
<p><label>Country: </label><select><option>Choose</option></select></p>
<p><label>Age: </label><select><option>Choose</option></select></p>
</fieldset> 

</body>
</html>
4

2 回答 2

0

我的问题得到解决,通过强制标签为 1px 并设置 white-space:nowrap; 示例:http: //jsfiddle.net/DpGcW/

fieldset label {
text-align: right;
width: 1px;
white-space:nowrap;
}
于 2012-12-11T14:49:26.263 回答
0

你想要这样的东西吗?

即字段集的图像

这是代码,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
fieldset {
width: 500px;
}
fieldset {
    display: inline-block;
}
fieldset input, 
fieldset select, 
fieldset label {
    display: table-cell;
    margin: 3px;    
}
fieldset label {
    text-align: right;
}
</style>
</head>
<body>
<fieldset>          
<label>First Name: </label><input type="text" /><br>
<label>Second Name: </label><input type="text" /><br>
<label>Country: </label><select><option>Choose</option></select><br>
<label>Age: </label><select><option>Choose</option></select>
</fieldset> 
</body>
</html>
于 2012-12-11T09:24:28.163 回答