【发布时间】:2013-02-08 03:25:53
【问题描述】:
我有一个 cmets 列表,它们的内容位于绝对定位的 div 中。这是设计的一部分。它们在一个设置为 display: none 的弹出框中,然后使用点击事件淡入。
我遇到的问题是我需要获取内部绝对内容的高度并将该高度设置为其父级,但似乎无法使其正常工作。每个项目都可以是任何长度,因为它们是 cmets。
我在这里做了一个小提琴来展示我有什么样的结构。 http://jsfiddle.net/ZTDyA/
这是结构
<div class="hidden">
<ul class="list">
<li>
<div class="inner">there is some content here</div>
<div class="base">This is a div under the .inner div</div>
</li>
<li>
<div class="inner">For the thing I have made this has to be positioned absolutely, but the content could be of any length so I need the parent to each of these inners to be set to the height of the inner div.</div>
<div class="base">This is a div under the .inner div</div>
</li>
</ul>
</div>
【问题讨论】:
-
为什么不能从
.inner中删除position: absolute? jsfiddle.net/dfsq/ZTDyA/2 -
由于设计原因,评论必须位于悬停时可见的另一层之上。
标签: javascript jquery html css absolute