Play parent div in CSS

I have a problem with the site I'm collecting. I have a simple div layout. It looks like this:

<body>
    <div id="Container">
        <div id="Logo"></div>

        <div id="Banner">
            <div id="Nav"></div>
        </div>
        <div id="Content">
        </div>

        <div id="footer">Footer</div>
    </div>
</body>

And my CSS looks like this:

@charset "utf-8";
/* CSS Document */


html, body {
    height:100%;
    padding:0;
    margin:0;
    background-image:url(../layout.img/background_gradient.gif);
    background-repeat:repeat-x;
}

#Container {
    height:100%;
    width:950px;
    margin:auto;

    background-color:#FFFFFF;
    border-left:1px solid #333333;
    border-right:1px solid #333333;
}

#Logo {
    width:160px;
    height:160px;
    float:right;
}

#Banner {
    width:100%;
    height:160px;
}

#Nav {
    width:550px;
    height:33px;
    position:relative;
    top:100px;
    left:50px;
}

#Content {
    clear:both;
}

And finally, the result can be seen here:

http://jsfiddle.net/mczMS/

As you can see, the “div” of the container does not stretch with the contents when scrolling down the page. I know that this is probably something stupid, but today I do not have enough brain power. Haha

+3
source share
2 answers

Try adding:

#container { min-height: 100%; }

after a height of 100%. You can also try:

#container { overflow: auto; }
+8
source

: 100% , .

+4

Source: https://habr.com/ru/post/1723303/


All Articles