Container with Height:auto

Return to article

We can get a container to stretch the length if we don't set its height attribute, or set it to "auto" (these are equivalent). This looks OK with pages that are equal to or greater than the total visible height of the page. Obviously, if the text isn't long enough, you get a block that is too short.

<style type="text/css"> body { margin:0; padding:0; position:absolute; height:100%; background-color:orange; width:100%; } div.full { position:absolute; top:0; left:25%; width:50%; background-color:white; padding:0 1em; } </style>