如何让两个场地集都成为最高场地的高度?这是代码,也可以在http://jsfiddle.net/zpcXQ/2/
看到<div id="parent">
<form>
<fieldset id="left">
<legend>Left</legend>
<p>line 1</p>
<p>line 2</p>
<p>line 3</p>
</fieldset>
<fieldset id="right">
<legend>Right</legend>
<p>line 1</p>
</fieldset>
</form>
</div>
fieldset {
border: 1px solid green;
width: 48%;
position: relative;
}
#parent {
float: left;
width: 600px;
position: relative;
}
#left {
float: left;
}
#right {
float: left;
}
答案 0 :(得分:0)
您可以使用jquery执行此操作:
var fieldSets = $("fieldset").toArray();
var highest = 0;
for(var i=0; i< fieldSets.length; i++){
var tempHeight = $(fieldSets[i]).height();
if(tempHeight > highest){
highest = tempHeight;
}
}
$("fieldset").height(highest);