2011-02-24 61 views

回答

13

不能,除非您在DOM中重新找到它。

使用position:fixed如果你希望它是相關的,而不是相關文檔窗口可能是一種替代)

1

您可以使用position: absolute;負值:

HTML:

<div id="parent"> 
     <div id="child"> 
      The child's content 
     </div> 
</div> 

CSS:

#parent 
{ 
    position: relative; 
    top: 200px; 
    border: 1px dashed #f00; 
    height: 50px; 
    width: 200px; 
} 

#child 
{ 
    position: absolute; 
    top: -200px; 
} 

這應該這樣做。 Example for you here

+1

啊,就是工作,如果家長沒有被設置爲位置:相對... – Gidon 2011-02-24 11:49:35

+0

更新到包括位置相對。 – Kyle 2011-02-24 11:50:05

+0

有沒有辦法徹底忽略父母? – Gidon 2011-02-24 11:51:53