How to position absolute inside a div?

后端 未结 4 570
梦如初夏
梦如初夏 2020-12-24 11:49

I\'m having a strange problem positioning a set of divs inside another div. I think it will be best to describe it with an image:

Inside the black (#box) di

4条回答
  •  忘掉有多难
    2020-12-24 12:17

    The absolute divs are taken out of the flow of the document so the containing div does not have any content except for the padding. Give #box a height to fill it out.

    #box {
        background-color: #000;
        position: relative;
        padding: 10px;
        width: 220px;
        height:30px;
    }
    

提交回复
热议问题