Ice example - The size and position of the site is fixed.
Jello example - The
size is fixed but free to move with the available space.
Liquid example -
Flexible size and position making the most of all available space.
The following is the code for the creation of a relatively positioned <div> element. That is an element positioned relative to the surrounding content.
<div style="position:relative; width: 200px; height:150px; background-color: green"></div>
To achieve this we create another <div> between the opening and closing tags of the parent <div>.
Note the use of position: absolute, this gives us full control of the position of the second <div> based on the container object or first <div>. This is not really necessary in this case as the header would have automatically slotted itself into the first available space which is the top left corner.
<div style="position:relative; width: 200px; height:150px;
background-color: green">
<div style="position:absolute; width: 200px; height:20px; background-color:
red"></div>
</div>
<div style="position:relative; width: 200px; height:150px; background-color:
green">
<div style="position:absolute; width: 200px; height:20px; background-color:
red"></div>
<div style="position:absolute; width: 35px; height:130px; background-color:
white; top:20px"></div>
</div>
<div style="position:relative; width: 200px; height:150px;
background-color: green">
<div style="position:absolute; width: 200px; height:20px; background-color:
red"></div>
<div style="position:absolute; width: 35px; height:130px; background-color:
white; top:20px"></div>
<div style="position:absolute; width: 165px; height:130px; background-color:
silver; top:20px; left:35px;"></div>
</div>
overflow:auto;
That's more like it now I can waffle on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on without a care for the initial size of the <div> tags I created.
Next: Layout using the CSS box model