Skip to content Skip to sidebar Skip to footer

How-to Mix Fixed And Percentage Heights/width Using Css Without Javascript

I want to achieve a layout like this: ----------------------------------------------------------- | | | fixed height

Solution 1:

See:http://jsfiddle.net/s7FH6/show/ (edit)

HTML:

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

CSS:

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden
}
#header {
    background: #ccc;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 150px
}
#content {
    background: #eee;
    position: absolute;
    left: 0;
    top: 150px;
    bottom: 0;
    width: 100%;
    overflow-y: scroll
}

Solution 2:

you can achieve layout like that very simple to be honest just read about divs and some css heres a example:

<divstyle="width: 604px; height: 405px; border: solid 1px black;"><divstyle="width: 100%; height: 100px; border: solid 1px green;"></div><divstyle="width: 100%; height: 74%; border: solid 1px blue;"></div></div>

dont forget that the width: 604px is only for example just set it to 100% to use all screen size same goes for height.

good luck.

example: http://jsfiddle.net/DCbur/2/

dont forget to vote if you like the answer

Post a Comment for "How-to Mix Fixed And Percentage Heights/width Using Css Without Javascript"