tags:

views:

59

answers:

1

I'm creating a complex layout in CSS and have to have the following:

__________________________________________
|     |                                   |
|     |              filters              |
|     |___________________________________|
|     |                                   |
|     |              Toolbar              |
|     |___________________________________|
| nav |                                   |
|     |                                   |
|     |                                   |
|     |         Content (scroll)          |
|     |                                   |
|     |                                   |
|_____|___________________________________|

The nav is static, so it's always shown. The content area is scrollable in itself. The toolbar is also always there. The filters section however should be dynamic in that if it is missing, then then toolbar/content should move upwards and take up the space that the filters once occupied.

The content area is position:absolute; with overflow:auto, and looks much like Google Reader. The problem is that I need to do right:0; top:0; left:0; and bottom:0 in order to get the scrolling to work correctly.

Any idea how I can achieve a scrolling content area that doesn't display over the top of the toolbar/filters yet if the filters section is removed then everything moves up automatically without me having to specify extra CSS to compensate?

Cheers

EDIT: Okay, to make it easier, can someone tell me how to achieve the layout of Google Reader using CSS, where the content area automatically moves down if you introduce new tools on the toolbar that cause the toolbar height to adjust?

+1  A: 

Would something like this fit your needs?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Untitled Document</title>
        <style type="text/css">
            body {
                margin: 0;
                padding: 0;
            }
            #nav {
                position: fixed;
                float: left;
                width: 25%;
                background-color: #F00;
            }

            #filters {
                float: right;
                width: 75%;
                background-color: #FF0;
            }

            #toolbar {
                float: right;
                width: 75%;
                height: 70px;
                background-color: #00F;
            }

            #content {
                float: right;
                width: 75%;
                background-color: #0FF;
                overflow-y: scroll;
                min-height: 400px;
            }

        </style>
    </head>
    <body>

        <div id="nav">this is the nav</div>

        <div id="filters">filters</div>
        <div id="toolbar">topbar</div>
        <div id="content">content</div>

    </body>
</html>
Frankie
Whilst I haven't tried it, I don't get why the height of the content area is 80% if the toolbar and filters section is of a fixed height? Surely it should be 100% height to fill in the gaps when the toolbar/filters aren't there?
Kezzer
This is close, but the content area needs to always fill the entire space.
Kezzer
@Kezzer, ah! But then you have to trough Java Script into it or stick to tables. You can get 100% height with DIV's. On the other 80% thing, your correct... I fussed about and forgot to delete the values.
Frankie