0

I want to use a simple layout, sidebar, subsidebar and the main content, all columns need to be the same in height. Here's when I get stuk, the columns need to be min- screen height if they are empty, and if 1 column has an element/content the other columns need to be the same height.

// het idea

<div id="container">

    needs to be min-heigth 100%

    <div id="sidebar">

        needs to be 40px width

    </div>
    <div id="subsidebar">

        needs to be 200px width

    </div>
    <div id="content">

        needs to be 100% width
        <div class="some-element-is-3000">
            3000px height(example)
        </div>
    </div>
</div>
user759235
  • 2,147
  • 3
  • 39
  • 77
  • no this is not the same, I am looking for a layout that has NOT a fixed height. The layout must be a minimum of 100% screen height. – user759235 Feb 19 '14 at 18:23

1 Answers1

2

Try the below fiddle.It uses display:table; and display:table-cell;:

CSS

html,body,#container{
    width:100%;
    height:100%;
}
#container{
    display:table;
}
#sidebar,#subsidebar,#content{
    border:1px solid black;
    display:table-cell;
}
#sidebar{
    min-width:40px;
}
#subsidebar{
    min-width:200px;
}
#content{
    width:100%;
}
  1. Fiddle with all three divs with less contents Fiddle

  2. Fiddle with content div exceeding window height Fiddle

Zword
  • 6,605
  • 3
  • 27
  • 52