Div height 100% and expands to fit content

后端 未结 15 921
攒了一身酷
攒了一身酷 2020-11-29 15:51

I have a div element on my page with its height set to 100%. The height of the body is also set to 100%. The inner div has a background and all that and is different from t

15条回答
  •  一整个雨季
    2020-11-29 16:29

    I'm not entirely sure that I've understood the question because this is a fairly straightforward answer, but here goes... :)

    Have you tried setting the overflow property of the container to visible or auto?

    #some_div {
        height:100%;
        background:black; 
        overflow: visible;
        }
    

    Adding that should push the black container to whatever size your dynamic container requires. I prefer visible to auto because auto seems to come with scroll bars...

提交回复
热议问题