Element doesn't appear in IE7 until I edit it through Developer Toolbar

此生再无相见时 提交于 2019-12-03 15:38:00

I fixed this by moving the disappearing element one level deeper, into another child element. Since the child element is floated, but does not have a position, the disappearing element is still positioned relative to the parent element, which is what I want - but for some reason this also causes it to be visible in IE7, like it's supposed to be.

This is what I had that caused the element to disappear (not the real IDs):

<div id="parent" style="position: relative;">
  <div id="disappear" style="position: absolute; left: -8px; top: -17px;>This element disappears</div>
</div>

This is what makes it appear:

<div id="parent" style="position: relative;">
  <div id="child" style="float: left; width: 340px;">
    <div id="disappear" style="position: absolute; left: -8px; top: -17px;">Now this element appears</div>
  </div>
</div>

Floating #parent and giving it a width (the same two properties that #child has) didn't work, though - I have to use a separate child element. Totally bizarre, but figured I'd post this in case anyone else runs into the same problem!

Isn't it weird how IE developer tool bar triggers it to be visible?!

I fixed it by instead of using absolute positioning for the child element using relative positioning with a negative margin-left to position the element. Not ideal as it makes the design more fragile, but my only option at the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!