How I can overlap a DIV on to other DIV?

后端 未结 3 756
梦如初夏
梦如初夏 2021-01-26 04:16

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

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

in css, but I found that this top

3条回答
  •  独厮守ぢ
    2021-01-26 04:40

    Here's an easy way

    CSS

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

    HTML

    I'm the top div
    No styles, just frowns :(

    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.

    Fiddle

    http://jsfiddle.net/y5SzW/

提交回复
热议问题