如何将DIV与其他DIV重叠? [英] How I can overlap a DIV on to other DIV?

查看:148
本文介绍了如何将DIV与其他DIV重叠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在视觉上将DIV重叠到另一个上。我正在尝试

I am trying to make an overlapping a DIV onto other visually . I am trying

{
position:absolute;
top:-10px;
}

在CSS中,但是我发现此top属性在firefox中无法正常工作。亲爱的家伙,该怎么做?请帮我一些代码或示例。
thx

in css, but I found that this top attribute is not working properly in firefox. Dear fellas, how to do that? Please help me with some codes or examples. thx in advance

推荐答案

这是一个简单的方法

.top {
    position: relative;
}
.topabs {
    position: absolute;
}



HTML



HTML

<div class='top'>
    <div class='topabs'>
        I'm the top div
    </div>
</div>
<div>No styles, just frowns :(</div>​

相对位置的div由于没有内容而折叠,导致绝对位置div的坐标0,0坐标是其下的div的坐标。

The relative positioned div collapses as there are no contents, causing the coordinates 0,0 coordinates of the absolute positioned div to be that of the div underneath.

http://jsfiddle.net/y5SzW/

这篇关于如何将DIV与其他DIV重叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆