我需要在Div母容器内堆放Div。 父母Div容器也是孩子或父母容器内。
我的问题是,当把divs堆叠成像素时,一切都是好的;然而,如果我需要在一个Divs堆下面或中间滑进去,有时我松开一个像素。我知道不可能有0.3232像素,我假设我在小数点处丢掉一个像素。
我有一套常数,作为Var Pixels_PER_FOOT=25;
如果我有一个像以下这样的结构, 我怎样才能设定一个与超级父母成比例的 儿童元素的百分比?
<div id="superParent" height= 500px OR 20 Feet >
<div id="anotherParent" height="300px" OR 12 Feet >
<div id="aChild" height=If this div is 3 Feet
I need to get the percentage of 3 foot from 20 foot and
apply
that percentage to its parent or
what I am calling the anotherParent
</div>
</div>
所以如果 3/20 = 15%。 我需要得到 12/20 = 60%, 这也是我迷失的地方。 因为将 15% 的 儿童元素应用到 儿童元素 是不正确的, 因为它的父母不是我从中获取主要百分比的人数 。
我不能用jQuery来做这个。