是否可以相对于另一个DIV定位DIV?我想这可以通过首先将它放在参考DIV,然后使用 position:relative 。但是,我不知道如何做,而不影响参考DIV的内容。如何正确地完成此操作?
请参阅: jsfiddle/CDmGQ
谢谢! =)
解决方案将父DIV的位置 c $ c> relative (指定偏移量,即 left , top 没有必要),然后将 position:absolute 应用到您想要的偏移量的子DIV。 这很简单,应该做的很好。 p>
Is it possible to position a DIV relative to another DIV? I imagine this can be done by first placing it inside of the reference DIV, and then using position: relative. However, I can't figure out how to do this without affecting the contents of the reference DIV. How can I do this properly?
See: jsfiddle/CDmGQ
Thanks! =)
解决方案First set position of the parent DIV to relative (specifying the offset, i.e. left, top etc. is not necessary) and then apply position: absolute to the child DIV with the offset you want. It's simple and should do the trick well.
更多推荐
相对于另一个DIV的位置DIV?
发布评论