Question

My page consists from 4divs: header at the top, in the middle are menu div and content div, and at the bottom is a footer div.

Footer should be fixed at the bottom of the screen. I would like that the content div would be stretched from the header div to the footer div. If I use

position: absolute; 
top: 80px; 
bottom: 30px; 

then the content is stretched to the footer but after that the content is not stretched to the right. Please check the code below. I would like that the content colored with red would stretch vertically from green to yellow colour and horizontally from blue to the right edge of the screen.

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><tiles:insertAttribute name="title" ignore="true" /></title>
        <style>
        html,body{
            margin:0;
            padding:0;
            height:100%;
        }

        #javanus_header{
            height: 80px;
            background:#AAF054;
        }

        #javanus_footer{
            position:absolute;
            bottom:0;
            width:100%;
            height:30px;/* Height of the footer */
            background: yellow;
        }
        #javanus_menu{
            float: left;
            position: absolute;
            top: 80px;
            height:200px;
            width: 200px;
            background: blue;
        }
        #javanus_content{
            height: 300px;
            margin-left: 200px;
            background: red;
            top:100px;
            bottom:50px;
            background-image:url(img/assist.png);
            background-repeat: no-repeat;
            background-position:center;
        }
    </style>
    </head>
    <body>
        <div id="javanus_main">
            <div id="javanus_header">
            </div>
            <div id="javanus_body">
                <div id="javanus_menu">
                </div>
                <div id="javanus_content">
                </div>
            </div>
            <div id="javanus_footer">
            </div>
        </div>
    </body>
</html>

Best regards, Javanus

Était-ce utile?

La solution

I'm assuming that's what you need.

Check Working example at http://jsfiddle.net/hk4p5/2/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top