CSS: auto height on containing div, 100% height on background div inside containing div

前端 未结 9 987
忘了有多久
忘了有多久 2020-12-22 20:10

The problem, is that I have a content div which stretches its container height-wise (container and content div have auto height).

I want the background container,

9条回答
  •  臣服心动
    2020-12-22 21:00

    Somewhere you will need to set a fixed height, instead of using auto everywhere. You will find that if you set a fixed height on your content and/or container, then using auto for things inside it will work.

    Also, your boxes will still expand height-wise with more content in, even though you have set a height for it - so don't worry about that :)

    #container {
      height:500px;
      min-height:500px;
    }
    

提交回复
热议问题