我无法将div2放在div1之上(不是在z-索引中,而是在垂直维度中)。 负面位置:顶部不工作,看起来像父母的顶部边界div是儿童的限制。
I cant position div2 above div1 (not in the z-index but in vertical dimension). Negative position: top not working, seems like top border of parent div is limit for childrens.
|-------| | div2 | ------| | | |_______| | | | div1 | |__________|推荐答案
以数字开头的类名无效,尽管它可能适用于某些浏览器。使用 div1 或 div2 并且这应该起作用。查看此答案
Class names starting with digits are not valid, although it may work in some browsers. Use div1 or div2 and that should work. Take a look at this answer for a good explanation of valid CSS class names.
评论后更新:
好的好吧,没有看到有问题的代码,很难看到问题出在哪里。但是使用这个CSS你可以重现你的图:
Ok, well, without seeing the offending code, it's hard to see where the problem is. But using this css you can reproduce your diagram:
#div2 { position:relative; top:-30px; left:100px; }因为我认为你已经知道了......但也许你忘记了位置:相对于?无论如何,请参阅小提琴。
As I think you already know.. but maybe you forgot the position:relative? Anyway, see it working in this fiddle.
更多推荐
将子div放在父div之上
发布评论