我有这个结构:
<div style="position: relative" id="i1">
<ul style="display: block" id="i2">
<li style="display: inline-block; position: relative;" id="i3">
<ul style="display: block;position: absolute; left: -??px; right: ??px" id="i4"> // visible on parent elm:hover
<li>..</li>
<li>..</li>
<li>..</li>
</ul>
</li>
</ul>
</div>
我确实需要在DIV id = i1的整个宽度上显示悬停元素id = i4,但是当我的父元素是元素id = i3,并且此元素是相对内联时,我如何达到左边的值和正确的属性?我可以通过CSS清理它吗?
答案 0 :(得分:0)
解决了,(我的愚蠢):
<div style="position: relative" id="i1"> /// only relative parent element
<ul style="display: block" id="i2">
<li style="display: inline-block; /*position: relative;*/" id="i3"> // removed position: relative;
<ul style="display: block;position: absolute; left: 0px; right: 0px" id="i4"> // visible on parent elm:hover
<li>..</li>
<li>..</li>
<li>..</li>
</ul>
</li>
</ul>
</div>