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

前端 未结 9 981
忘了有多久
忘了有多久 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 20:50

    I ended up making 2 display:table;

    #container-tv { /* Tiled background */
        display:table;
        width:100%;
        background-image: url(images/back.jpg);
        background-repeat: repeat;  
    }
    #container-body-background { /* center column but not 100% width */ 
        display:table;
        margin:0 auto;
        background-image:url(images/middle-back.png);
        background-repeat: repeat-y;
    
    }
    

    This made it have a tiled background image with a background image in the middle as a column. It stretches to 100% height of page not just 100% of browser window size

提交回复
热议问题