2011-01-12 13 views
0

私は絶対にap divを使用しなければならない場所に移動します。問題は:私はラッパーdivをクリアする方法を見つけることができません。私のトリックはうまくいきません。ap divを含むクリアラッパーdiv

私はラッパーdivの高さ設定を失いたいと思っていますが、依然としてap divsを含んでいます。

アイデア?

<pre> 
<code> 
#wrapper { 
position:relative; 
width:600px; 
height:1200px; --- wanna dump this but can't find way to clear 
margin-right: auto; 
margin-left: auto; 
background-color: #0CF; 
z-index:100; 
} 
#apDiv1 { 
position:absolute; 
width:200px; 
height:115px; 
z-index:1001; 
left: 89px; 
top: 329px; 
background-color: #0C0; 
} 
#apDiv2 { 
position:absolute; 
width:100px; 
height:50px; 
z-index:1000; 
left: 383px; 
top: 36px; 
background-color: #F39; 
} 

div id=wrapper 
    div id=apDiv1 closediv 
    div id=apDiv2 closediv 
div-- close wrapper 

答えて

0

クリアは、絶対配置された要素ではなく、浮動小数点数に使用されます。絶対配置された要素をクリアすることはできません。

0

できません。内側の絶対配置された要素を含むようにラッパーの高さを指定する必要があります。絶対配置された要素はスペースを占有しないため、ラッパーがそれらを囲むことは不可能です。

また、適切なコンテキストで使用するとap divsがすばらしいです。あなたはそれらを手にしてはいけません。

0

あなたは最高の子を取得し、

var t=0; // the height of the highest element (after the function runs) 
var t_elem; // the highest element (after the function runs) 
$("*",elem).each(function() { 
    $this = $(this); 
    if ($this.outerHeight() > t) { 
     t_elem=this; 
     t=$this.outerHeight(); 
     alert(t); 
    } 
}); 
以下のjQueryによって親にこの最高の高さを追加することができます
関連する問題