52,797
社区成员
发帖
与我相关
我的任务
分享
<style type="text/css">
.outerDiv{padding:4px;border:solid 2px black;}
.innerDiv{border:solid 2px #ff7f27;height:50px;}
</style>
<div class="outerDiv" style="width:300px;height:334px;float:left;margin-right:50px;"><div class="innerDiv"></div></div>
<div class="outerDiv" style="width:180px;height:290px;float:left;margin-right:50px;"><div class="innerDiv"></div></div>
<div class="outerDiv" style="width:200px;height:447px;float:left;margin-right:50px;"><div class="innerDiv"></div></div>
<div style="clear:both"></div><!--清除浮动,要不下面的这个div在Firefox下会导致空白边叠加而不显示-->
<div class="outerDiv" style="width:800px;height:100px;margin-top:50px;"><div class="innerDiv"></div></div>
1.
$("div[name='innerDiv']").width($.("div[name='outDiv']").width() - 4);
$("#innerDiv").width($.("#outDiv").width() - 4);